Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with touching?

I have a part and when something hits it, it grows. I want only if a human touches it.

x = game.Workspace.Cube.Part
settime= 1
mov = false

x.Touched:connect(function()
if mov == false then
mov=true
x.Size = x.Size + Vector3.new(1,1,1)
x.CFrame = CFrame.new(-8,-1,-3)
wait(settime)
mov=false
end
end)

1 answer

✓ Accepted answer
x = game.Workspace.Cube.Part
settime= 1
mov = false

x.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then -- checks if theres a humanoid
if mov == false then
mov=true
x.Size = x.Size + Vector3.new(1,1,1)
x.CFrame = CFrame.new(-8,-1,-3)
wait(settime)
mov=false
end
end
end)

2 comments

3

Firstly, explain your answers. Secondly, tab your code.

0

@HungryJaffer I explained the only line that I added, sendonly tabbing code isn't even a rule so :3

This discussion is preserved as it was. New answers, comments, and votes are closed.