Delay in touched event due to lag

local scripts are based on the clients, they never runs slower, clients normally are faster ( depends on the fps )

1 Like

Oh I didnt even notice that, do you think thats the issue?

1 Like

So should I run an event, or put everything in one script?

1 Like

put it on a local script. not a remote event just a local script they run faster and they donā€™t lag. it only lags on the client

1 Like

Putting it in a local script doesnā€™t work, the player does not jump

2 Likes

okay. put all the pads in a folder then loop through them. then if the pad is touched make the humanoid.Jump =true

1 Like

How exactly would I loop through them?

1 Like

for i, pad in pairs(folder to pads) do

end

for _, pad in pairs(workspace.Pads:GetChildren()) do

end

1 Like

then just do the pad.Touched now there isnā€™t a lag to the jump cause itā€™s using 1 script

1 Like

Thank you, Iā€™m gonna test it and see how it goes

1 Like

use the documentation to learn more and use the forums!

1 Like

Hey I did what you said but it does not seem to work, did I do something wrong?

Local script inside the folder

local Player = game.Players.LocalPlayer
local Hum = Player.Character:FindFirstChild("Humanoid")
local GreenPads = game.Workspace.Platforms.StarterGreenPads
for i, pad in pairs(GreenPads:GetChildren()) do
    pad.Touched:Connect(function()
        if Hum then
            Hum.Jump = true
            print("Working")
        end
    end)
end
1 Like

that script will make you jump forever

1 Like

after the pairs, so if pad:IsA(ā€œBasePartā€) then

1 Like

when i get home lemme make a script for you. and it will work

2 Likes

Alright thank you so much!

30 30

2 Likes

So I got it to work. Put a script in workspace / serverscriptservice or in the folder of startergreenpads.

local starterGreenPads = workspace:WaitForChild("StarterGreenPads")

for i, pad in pairs(starterGreenPads:GetChildren()) do -- Loop through the StarterGreenPads
	if pad:IsA("BasePart") then -- If it's a part
		pad.Touched:Connect(function(hit) -- Touched
			local humanoid = hit.Parent:FindFirstChild("Humanoid") -- Find the Humanoid

			if humanoid then -- If the humanoid is a humanoid
				humanoid.Jump = true -- humanoid jumps!
			end
		end)
	end
end
3 Likes

Thank you so much it definitely helps a lot!

3 Likes

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