I need Help With script how do i make Function after Touched delay

i cannot seem to find problem where to put the delay

local Trap = script.Parent
local spike1 = game.Workspace.Trap1.Spikes1
local spike2 = game.Workspace.Trap1.Spikes2
local ColorZ = script.Parent.SelectionBox



function trapped ()
	
	
	for i = 1,10  do
		
		spike1.CFrame = spike1.CFrame*CFrame.new(0,0,0.01)
		
		wait(0.1)
		
	end
		
		
end




Trap.Touched:Connect(trapped)
local Trap = script.Parent
local spike1 = game.Workspace.Trap1.Spikes1
local spike2 = game.Workspace.Trap1.Spikes2
local ColorZ = script.Parent.SelectionBox
function trapped ()
	
	
	for i = 1,10  do
		
		spike1.CFrame = spike1.CFrame*CFrame.new(0,0,0.01)
		
		wait(0.1)
		
	end
		
		
end




Trap.Touched:Connect(trapped)

You don’t have a wait(time) function in your code, and that is what is delaying.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.