So this script is inside a boulder and I want the boulder to fall down the hill and hit the players. But it only starts to move when a player touches it.

local db = false
local db2 = false
script.Parent.Touched:connect(function(p)
	if p.Parent:findFirstChild("Humanoid") and db == false then
		db = true
		local q = p.Parent:FindFirstChild("Humanoid")
		if q ~= nil then
			q.Sit = true
			db2 = true
			q.Changed:connect(function(prop)
				if prop == "Jump" and db2 == true then
					q.Jump = false
				end
			end)
			wait(2)
			q.Sit = false
			db = false
			db2 = false
		end
	end
end)

script.Parent.Changed:connect(function(cng)
	print("change")
	if cng == "Position" or cng == "Rotation" then
		wait(5)
		script.Parent:Destroy()
	end
end)

I want it to move before the player is able to get to it. Any possibility of doing that?

2 comments

0

you could either use magnitude or use the Touched event on some kind of "trigger block"