Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
sonuka 24
6 years ago
Edited 6 years ago

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
0
Did you define what `Player` was? https://wiki.roblox.com/index.php?title=API:Class/Player/GetMouse T0XN 276 — 6y
0
do "Player= game.Players.LocalPlayer" with local script otherwise it will not work THEROBLOXAIN2 15 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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.

0
ohhh yea its not a localscript thanks sonuka 24 — 6y
0
Please set the answer to correct if it helped. xAtom_ik 574 — 6y
0
ok done sonuka 24 — 6y
Ad

Answer this question