When touch part then activate my script. Need Help

Can someone do when touch a part then activate



cam.CFrame=cam.CFrame*CFrame.Angles(math.random(-3,3)/360,math.random(-3,3)/360,math.random(-3,3)/360)

cam.FieldOfView=math.random(69,71)

wait()

end

If you know anything please reply!

1 Like

Just connect your code to a Touched event. Example:

local part = workspace.Part -- the part you want to be touched

part.Touched:Connect(function(hit)

    -- code here

end)
1 Like

You could also place a script into the part and say

local part = script.Parent


part.Touched:Connect(function(hit)
2 Likes