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

How do I make this script trigger on player touch?

Hey, I have this script that makes a part move up and down however I would like the script to start when I have touched the part? How would I do this? Any help would be great ! :D

Here is the script:

for i=1, 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, 1 do
distance = 250

for i = 0, distance do 
script.Parent.CFrame = script.Parent.CFrame+Vector3.new(0,0.2, 0)
wait()
end 


for i = 0, distance do 
script.Parent.CFrame = script.Parent.CFrame-Vector3.new(0,0.2,0)
wait()
end 
end 

3 comments

0

just use a while loop lol

0

or do math.huge

0

dude how hard is it to use google? like fr

1 answer

Script in a part (not localscript):

script.Parent.Touched:connect(function(hit)
local victim = hit.Parent
--script here
end)

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