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

GetMouse work in studio but not ingame help......?

The error I get is attempt to index local 'z'(a nil value). Can someone help please thx.

local z = Player:GetMouse()
local v = Instance.new("BodyVelocity", Player.Character.UpperTorso)
		v.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
		v.Velocity = z.hit.lookVector * 100

2 comments

0

do "Player= game.Players.LocalPlayer" with local script otherwise it will not work

1 answer

✓ Accepted answer

The :GetMouse() Function only works in localscripts, if it is in one already, check any errors with the Player variable. | If this was the answer, please mark it as the answer so I can get more reputation so I can help others as well.

3 comments

0

ohhh yea its not a localscript thanks

0

Please set the answer to correct if it helped.

0

ok done

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