I have a jump pad that when they touch it, it fires an event to make the player jump. The issue is that when the player has high ping, they take a while to jump (they sit there for a second before it makes them jump). Here is the code
pad = script.Parent
function jump(Hit)
local humanoid = Hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
game.ReplicatedStorage.Jump:FireClient(player)
print("fired")
end
end
pad.Touched:Connect(jump)
Perhaps try changing the script from a server script to a local script. It already looks like your using some code to make the user jump so try moving that code over to this script and have it all done on this script.
As far as I know, there is no need to connect an event.
The only code you need to make somebody jump is
Humanoid.Jump = true
pad = script.Parent
function jump(Hit)
local humanoid = Hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
humanoid.Jump = true
print("fired")
end
end
pad.Touched:Connect(jump)
The issue is with players with high ping this wouldn’t fix anything. Also its possible they have some sort of custom high jump as they said its a “jump pad”.
What the person said about the event was correct but they were referring to a context where it was server → client. In this case we are only talking about the client so a RemoteEvent will not work which is why you need to move the code from your client event and move it to this script for it to work.
I combined the scripts like you guys said and it is still just as delayed. For some more context, It works fine for people with normal ping, but for people with bad ping or recording the game (what I’m testing) it gets really delayed.
pad = script.Parent
function jump(Hit)
local humanoid = Hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
humanoid.Jump = true
print("fired")
end
end
pad.Touched:Connect(jump)
You didn’t answer my question? Have you tried switching the RunContext for your main jump pad script from Legacy to Client? Alternatively you could grab the code and put it in a local script.
pad = script.Parent
function jump(Hit)
local humanoid = Hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
game.ReplicatedStorage.Jump:FireClient(player)
print("fired")
end
end
pad.Touched:Connect(jump)
This was my script before I changed it to what you suggested