In-game group walking speed benefit

I need to increase the walkspeed of the player if they are in a certain group, I do not want to set it to a specific number but just increase it by a certain amount.
The print statement in the following code works but the script does not apply the change in speed.
I have tried searching for solutions on my own here and google but I have not found a suitable one including changing it to a local script.

local Players = game:GetService("Players")

local function onPlayerAdded(player)
	if player:IsInGroup(4352234) then
		print("player is in group")
		local character = player.CharacterAdded:Wait()
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.WalkSpeed = humanoid.WalkSpeed + 9
		
	end
end

Players.PlayerAdded:Connect(onPlayerAdded)

Thank you for your time!

Give this a shot.

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		if plr:IsInGroup(4352234) then 
			local hum = char:WaitForChild("Humanoid")
			hum.WalkSpeed += 9
		end
	end)
end)
2 Likes

Ah thanks, this works perfectly, I must have not established the connection or smth.

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