I have not tested it out, it might not work.
An important thing is that you should put local before each of your variables.
An another important thing that you should use is UserInputService or ContextActionService, both of those services do a lot(ContextActionService can create custom buttons on the screen and with UserInputService, you could check what device the player is using and much more stuff)
local player = game.Players.LocalPlayer
local uis = game:GetService("UserInputService")
local char = player.Character
local hum = char.Humanoid
local amount = 50
uis.InputBegan:Connect(function(key, gpe)
if key.KeyCode == Enum.KeyCode.Q and not gpe then
hum.WalkSpeed = hum.WalkSpeed + amount
end
end)
4 comments
Not answering to explain but a quick fix is: Delete your "ws = h.WalkSpeed" variable (Use Locals my man) and change the "ws" part inside the function to "h.WalkSpeed = h.WalkSpeed + 50". There's so many better ways to do this and you could probably start with UserInputService instead of using KeyDown from the mouse. Someone nice out here might be able to explain it too you if they can.
ok thanks
but why does that make a difference
http://wiki.roblox.com/index.php?title=Keyboard_input