+= is setting property not adding property

I am trying to make a dash ability for my game but when I coded the speed boost to be added it was setting the walkspeed to the value instead of adding and yes the walkspeed thats being added too the value before is 16

(16 + 15 is 15 instead of 31)

Here is the video proof:

Are you sure the walkspeed is not 0 while adding 15? Try printing the value before increasing it

This works perfectly fine:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Humanoid : Humanoid = Character:WaitForChild("Humanoid")
		while task.wait(1) do
			Humanoid.WalkSpeed += 1

		end
	end)
end)

Can I ask why you’re doing it using a module script rather then via the script exacuting it or even a remote function?

because the player haves more then one ability so I wanted to do a module for all the abilites

Have you tried finding out what it prints before making changes. If it’s returning nil then it can’t access that and you may want to do it via remote events or remote functions since modules are more for storing and retrieving data

1 Like

um I already solved the problem I had put the solution check and everything but thanks for replying!