##Code Information
I have a script that has a Touched event. The variable, speedPad, is listening to the touched event. I used an array called touchedSpeedPad to store all the character's names that have touched the speedPad. This made the SpeedPad more responsive, however, this doesn't prevent the lag occurring. Is there any way to hide and/or stop this lag from happening to the players.
##Some Other Important Stuff
####Please don't say to do debounce because debounce makes the players go one by one!
####Also, please don't say to use Part:GetTouchingParts() because the character's parts are CanCollide false
####People also say that I should handle this code on the client side. I don't think this is a good idea, however, I probably might be wrong. Should I listen to them?
Edit: Plus, the character's parts have no TouchInterest in them
##Code
local speedPad = script.Parent
local duration = jumpPad:WaitForChild("Duration")
local speed = jumpPad:WaitForChild("Speed")
local touchedSpeedPad = {}
local function onTouched(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local char = hit.Parent
if touchedSpeedPad[char.Name] then return end
touchedSpeedPad[char.Name] = true
humanoid.WalkSpeed = speed.Value
wait(duration.Value)
humanoid.WalkSpeed = 20
touchedJumpPad[char.Name] = nil
end
end
jumpPad.Touched:Connect(onTouched)

8 comments
Parts with CanCollide set to false still fire touched events.
I am not talking about the Touched event. Please read: "...don't say to use Part:GetTouchingParts() because the character's parts are CanCollide false". As you can see, I am not referring to Part:GetTouchingParts(), not Instance.Touched
Still, the method still gets parts that are CanCollide = false.
This is the exact description of Part:GetTouchingParts(), "Returns a table of all CanCollide true parts that intersect with this part. If the part itself is CanCollide false, then this function will return an empty table UNLESS it has a TouchInterest." Source: http://robloxdev.com/api-reference/function/BasePart/GetTouchingParts
Where do you think the lag is stemming from?
I feel like the lag is input lag and/or latency lag.
I mean if it's latency lag, only real way to resolve it is by making this client-side. I agree that that's not probably the way to go. A way to counteract this lag is to maybe include an animation of some sort, client-side, so that it appears like the response time is more immediate. Sort of like revving up a toy car before letting it go.
When I make this client side, it seems to break much more than what I would do on Server Side