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

how can i make a speed script with remote functions?

so on my previous post i asked about how to make a shop gui. i got that working and i have more problems with the power ups now. how can i change the players speed using a remote function? this is the script i had for the gravity which i put in the serverscriptservice

game.ReplicatedStorage.PowerUps.Gravity.OnServerEvent:Connect(function(player)
    if player.leaderstats.Cash.Value >= 10 then
        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 10
		game.Workspace.Gravity = 90
    end
end)

is there any way to make a speed script by only modifying this or would i have to move the script as well?

1 answer

Hello! To change a player's speed, you have to modify the "WalkSpeed" property of their humanoid.

game.ReplicatedStorage.PowerUps.Gravity.OnServerEvent:Connect(function(player)
    if player.leaderstats.Cash.Value >= 10 then
        player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 10
        player.Character.Humanoid.WalkSpeed = 100 -- Set the walk speed to 100!
    end
end)

And that should do the trick.

PS for the gravity, use the JumpPower property instead of gravity in workspace, to make sure that only the player that purchased the item recieves gravity!

player.Character.Humanoid.JumpPower = 90

~Dan_PanMan, advanced scripter.

2 comments

0

how can i make a speed script with remote functions?

0

my output just says that character is not a valid member of player

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