#How can i target multiple parts with the same name?
149 messages · Page 1 of 1 (latest)
my bad
i mean i just got it from roblox's city template
local inCar = script.Parent:GetChildren()
local plr = game.Players.PlayerAdded:Wait()
for _, v in pairs(inCar) do
if v.Name == "BackLeftWheel" then return end
if v.Name == "BackRightWheel" then return end
if v.Name == "FrontLeftWheel" then return end
if v.Name == "FrontRightWheel" then return end
if v.Name == "Light" then return end
if v:IsA("UnionOperation") then
v.BrickColor = plr.TeamColor
elseif v:IsA("BasePart") then
v.BrickColor = plr.TeamColor
end
end
kinda bad but working
where do i put this
inside ur car
idk
it's a little bit goofy but anyways
doesnt work : (
errors ?
no
uh k
I put it under the part where it says something like
Driversseat.changed
If player then
Yea
bruuuh
I put it above car.drivseat
Wat
Cause It's a red v blue but I want it so u can steal enemies cars
Ehwhat did I do wrong?
@lucid snow Tmr can you help me make a tank lol
naaaaaaaah
Dang it
So I'm trying to make another vehicle
By ctrl d
But now only certain part change
no
And doyou see the tank car thingy
i really gotta make it look better but its not all red
ok
nvm
add this after
** You are now Level 19! **
this after setcolor function
oh
wait
yea
it still says that
still on blue team and still red
ok, so the real thing im gona do is add a gui that opens a vechicle thingy and you can spawn it in
does that make it any easier
@lucid snow
sec
oh mb
player:GetPropertyChangedSignal("Team"):Connect(function()
setColor(player, car:GetChildren())
end
well im adding a gui so how can i do it so if u click the button it spawns the car at ur position with ur color?
sry
yes
yes
yes
yes
do i do something like ```lua
local RS = game.ReplicatedStorage
script.Parent.TextButton.MouseButton1Click:Connect(function(Player)
local PlrCar = RS.Jeep:Clone()
PlrCar.Parent = game.Workspace
PlrCar:PivotTo(Player.Position)
PlrCar.Color.Value = Player.TeamColor
end)
plrCar.Color.Value ?
is it server script ?
local RS = game.ReplicatedStorage
script.Parent.TextButton.MouseButton1Click:Connect(function(player: Player)
local PlrCar = RS.Jeep:Clone()
PlrCar.Parent = game.Workspace
PlrCar:PivotTo(Player.Position)
PlrCar.Color.Value = Player.TeamColor
end)
in the car script could i do instead something like ```lua function setColor(plr, inCar)
for _, v in pairs(inCar) do
if v.Name == "BackLeftWheel" then return end
if v.Name == "BackRightWheel" then return end
if v.Name == "FrontLeftWheel" then return end
if v.Name == "FrontRightWheel" then return end
if v.Name == "Light" then return end
if v:IsA("UnionOperation") then
v.BrickColor = script.Parent.Color.Value
elseif v:IsA("BasePart") then
v.BrickColor = script.Parent.Color.Value
end
end
end
setColor(player, car:GetChildren())```
no
use server script
but its a gui
local RS = game.ReplicatedStorage
local Player = game.Players.PlayerAdded:Wait()
script.Parent.TextButton.MouseButton1Click:Connect(function()
local PlrCar = RS.Jeep:Clone()
PlrCar.Parent = game.Workspace
PlrCar:PivotTo(Player.Position)
PlrCar.Color.Value = Player.TeamColor
end)
im just gonna do it with a gui script
as it also works
local Player = game.Players.PlayerAdded:Wait(), that doesnt mean its the local player
right?
???????????
how can i tell which player clicks the Textbutton
it means
bro 💀
im stupid