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

How do I change a player's walk speed after equipping a speed perk?

I want the player to equip the speed perk and gain the speed boost, but its not applying the boost. What am I doing wrong?

EquipButton.MouseButton1Down:connect(function()
	if InventoryItemImage.Image == "rblxassetid://769111505" then
		local HumanoidSpeed = game.Players.LocalPlayer.Humanoid.WalkSpeed
		if wins.Value >= 50 then
			HumanoidSpeed = HumanoidSpeed * 2
		elseif wins.Value >= 45 then
			HumanoidSpeed = HumanoidSpeed * 1.9
		elseif wins.Value >= 40 then
			HumanoidSpeed = HumanoidSpeed * 1.8
		elseif wins.Value >= 35 then
			HumanoidSpeed = HumanoidSpeed * 1.7
		elseif wins.Value >= 30 then
			HumanoidSpeed = HumanoidSpeed * 1.6
		elseif wins.Value >= 25 then
			HumanoidSpeed = HumanoidSpeed * 1.5
		elseif wins.Value >= 20 then
			HumanoidSpeed = HumanoidSpeed * 1.4
		elseif wins.Value >= 15 then
			HumanoidSpeed = HumanoidSpeed * 1.3
		elseif wins.Value >= 10 then
			HumanoidSpeed = HumanoidSpeed * 1.2
		elseif wins.Value >= 5 then
			HumanoidSpeed = HumanoidSpeed * 1.1
		end
	end
end)

Also, there error says this:

19:31:04.536 - Humanoid is not a valid member of Player

If Humanoid is not a valid member of players, then what controls the Health, Jump Power, and Walk Speed?

1 comment

2

Because Humanoid isn't a member of a player. It's a member of a player's character.

1 answer

You need to access the character by:

game.Players.LocalPlayer.Character

not just by:

game.Players.LocalPlayer

2 comments

0

Oh ok, I'll try.

0

Sorry, but it still doesn't work

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