Hello Im making a flappy bird type of thing (just for fun, im not ganna make it public or anything, im just doing this so i can practice my scripting)

Every thing works perfect... in studio when i try to open it in a real game, is the bird 1 jump behind the jump it must be By that i mean If the player jumps 3 times and stops the bird will jump 1 more time then it stops Im using remote events to make the client tell the sever when the player presses space Is there a way to fix it

my code

--- Client side
Input.InputBegan:Connect(function(Key)
    if Key.KeyCode == Enum.KeyCode.Space then
        if game.ReplicatedStorage.IsPlaying == false then
            if Wait == false then
                game.ReplicatedStorage.Position:FireServer()
                script.Parent.Parent.PlayerGui.Lost.Enabled = false
                Stop = false
                Start = false
            end
        else
            if game.ReplicatedStorage.IsPlaying.Value == false then
                game.ReplicatedStorage.Start:FireServer()
                Start = true
                Stop = false
            end
            game.Workspace.Birdy.Jump:FireServer() --- here is the line
        end
    end
end)



--- Sever Side
script.Parent.Jump.OnServerEvent:Connect(function()
    StopFunction = true
    delay(0.04, function()
        StopFunction = false
        Start2()
    end)
    
    if script.Parent.Anchored == true then
        script.Parent.Anchored = false
    end
    
    game.Workspace.SoundEffects.Jump.Shift.Octave = (math.random(9, 15)) / 10
    game.Workspace.SoundEffects.Jump:Play()
    script.Parent.Velocity = Vector3.new(0, 50, 0)
end)

thanks

1 comment

0

Place a debounce, that simple.