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

Anybody have an alternative to .Touched?

Hello! I'm trying to make a Spleef game, but whenever a player jumps on one of the bricks, it doesn't fade away, because the .Touched event doesn't fire if the touch is quick (jump on and off quickly).

Does anybody know any alternatives to .Touched, which could be used for lots of individual bricks?

I'm using this code with .Touched:

script.Parent.Touched:Connect(function(hit)

Regards, ChickenCrat

1 comment

0

Region3 will help you

1 answer

✓ Accepted answer

.Touched event seems to work just fine in a LocalScript when it comes to the detection of the player's character stepping on a brick,so:

-- LocalScript

-- local re=game.ReplicatedStorage:WaitForChild"RemoteEvent"

-- for _, SpleefPart in (SpleefParts) do

local pn,a=game.Players.LocalPlayer.Name,a
SpleefPart.Touched:Connect(function(v)
	if a then return end a=true
	v=v.Parent;if v and v.Name==pn and SpleefPart.Transparency==0 then
	SpleefPart.Transparency==.1
	re:FireServer(SpleefPart)
	end
	wait(.4)
	a=false
end)

--end

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