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

How do i change character properties if they touch this part?

Asked by 3 years ago

i tried putting this script

humanoid.Touched.Connect(function(hit, head)
    hit.BrickColor = BrickColor.new("Ghost grey")
    hit.Size =  Vector3.new(4,4,4)


end
script.Parent.Touched:connect(onTouched)

but it doesnt work, can someone help me? i am still new to scripting so i need some help

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

You did bit wrong:

2 Connects on One Function

To Connect Use The ":" Instead of "."

What part to touch? (line 1)

To change Propeties, hit.Parent is the Character, Character has the "Head" Child.

Try this script, put it on the part you want thats the player will touch:

In A Basic Script:

local part = script.Parent

part.Touched:Connect(function(hit)
       local hum = hit.Parent:FindFirstChild("Humanoid")
       if (hum~=nil) then
       hit.Parent.Head.BrickColor = BrickColor.new("Ghost grey")
       hit.Parent.Head.Size = Vector3.new(4,4,4)
       end
end)

If it worked, please Give a Soultion!

for More Body Parts, Heres some:

LeftUpperArm, LeftHand, LeftLowerArm: Left Arm

LeftLowerLeg, LeftFoot, LeftUpperLeg: Left Leg

RightUpperArm, RightHand, RightLowerArm: Right Arm

RightLowerLef, RightFoot, RightUpperLeg: Right Leg

0
thanks bud skeletonpiratejack 13 — 3y
0
No problem! RektwayYTB 123 — 3y
Ad

Answer this question