Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

what is wrong with my change body color on touch script?

Asked by 6 years ago

function onTouch(part) local Toucher = part.Parent:FindFirstChild("Humanoid") --The toucher

if Toucher ~= nil then --if someone touched our brick Toucher.Torso.CFrame = CFrame.new(-69.5, -6, -53)

end

end

fire1 = script.Parent fire1.Touched:connect(onTouch) --script for teleports you when you touch the part(fire1)

script.Parent.Touched:Connect(function(hit) --from here onwards, i really dont know what is wrong with the script to change body colors when you touch the part

end

local Toucher = fire1.Parent:FindFirstChild("Humanoid") wait(0) Toucher.Parent.FindFirstChild("Head").BrickColor = BrickColor.new(24) Toucher.Parent.FindFirstChild("Torso").BrickColor = BrickColor.new(23) Toucher.Parent.FindFirstChild("Left Arm").BrickColor = BrickColor.new(24) Toucher.Parent.FindFirstChild("Right Arm").BrickColor = BrickColor.new(24) Toucher.Parent.FindFirstChild("Left Leg").BrickColor = BrickColor.new(119) Toucher.Parent.FindFirstChild("Right Leg").BrickColor = BrickColor.new(119)

         end

end

script.Parent.Touched:connect(onTouch) --so what im trying to do is to make a part that teleports the toucher as well as color thier body

0
Please use code blocks. User#19524 175 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

You Put .FindFirstChild you can't call something with a . you have to use :FindFirstChild(Arguments)

Also you Have multiple onTouch function firing and you set one to a variable? so you have 3?

This:

Toucher.Parent:FindFirstChild("Torso").BrickColor = BrickColor.new(23) 
Toucher.Parent:FindFirstChild("Left Arm").BrickColor = BrickColor.new(24) 
Toucher.Parent:FindFirstChild("Right Arm").BrickColor = BrickColor.new(24) 
Toucher.Parent:FindFirstChild("Left Leg").BrickColor = BrickColor.new(119) 
Toucher.Parent:FindFirstChild("Right Leg").BrickColor = BrickColor.new(119)

You can't do any of the new body parts on R15 vs R6. R15 has Upper and lower ect....

BUTTTT what you can do is there is something in the Character Called Body Colors you Can Make the the Script find that..... and change them

Like This: IK.. I left ur code all nasty but I commented everything out you don't need

function onTouch(part) 
local Toucher = part.Parent:FindFirstChild("Humanoid") --The toucher

if Toucher ~= nil then --if someone touched our brick Toucher.Torso.CFrame = CFrame.new(-69.5, -6, -53)
Toucher.Parent:FindFirstChild("Body Colors").HeadColor = BrickColor.new(24)
Toucher.Parent:FindFirstChild("Body Colors").LeftArmColor = BrickColor.new(24)
Toucher.Parent:FindFirstChild("Body Colors").RightArmColor = BrickColor.new(24)
end
end
--[[ Kk I have no Idea why you have any of this..... No need for 2 on touch function
fire1 = script.Parent fire1.Touched:connect(onTouch) --script for teleports you when you touch the part(fire1)

script.Parent.Touched:Connect(function(hit) --from here onwards, i really dont know what is wrong with the script to change body colors when you touch the part

end

local Toucher = fire1.Parent:FindFirstChild("Humanoid") wait(0) Toucher.Parent.FindFirstChild("Head").BrickColor = BrickColor.new(24) Toucher.Parent.FindFirstChild("Torso").BrickColor = BrickColor.new(23) Toucher.Parent.FindFirstChild("Left Arm").BrickColor = BrickColor.new(24) Toucher.Parent.FindFirstChild("Right Arm").BrickColor = BrickColor.new(24) Toucher.Parent.FindFirstChild("Left Leg").BrickColor = BrickColor.new(119) Toucher.Parent.FindFirstChild("Right Leg").BrickColor = BrickColor.new(119)
    end
end
]]-- 
script.Parent.Touched:connect(onTouch) --so what im trying to do is to make a part that teleports the toucher as well as color thier body

And that should work.. Just look at the properties of Body Colors or google it and change them. and delete the commented out code and try not to break the script :) don't forget to check this answer

0
oh my god thank you so muchhhhh BakingPeanut -7 — 6y
Ad

Answer this question