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

why is it spawning a random "robux" block even when i didnt touch the block?

function block() > wait(5) > robux = Instance.new("Part", game.Workspace) > robux.Size = Vector3.new(0.5,3,0.4) > robux.Position = Vector3.new (0,5,0) end

script.Parent.Touched:Connect(block)

1 answer

✓ Accepted answer

Check for a humanoid.

function block(hit) 
	if hit.Parent:FindFirstChildOfClass("Humanoid") ~= nil then -- Checks if the humanoid is there, 	if it doesn't exist, it will return a nil value.
	wait(5)
	robux = Instance.new("Part", game.Workspace) robux.Size = 		Vector3.new(0.5,3,0.4) robux.Position = Vector3.new (0,5,0)
	end
end

script.Parent.Touched:Connect(block)

1 comment

0

oh that fixed it, thanks!

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