Player is already defined but what do I do to make GetMouse work? The error I get is attempt to index local 'z'(a nil value).
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
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. [Edited Below]
~-~-~-~-~-~-~-~-~-~-~-~-~
The script also uses only R15 so it will not have any effect on R6 users.
I have fixed your line of code as well:
plr = game.Players.LocalPlayer local z = plr:GetMouse() loaded = false plr.CharacterAdded:connect(function() --This triggers the loaded function to become true when character has loaded loaded = true end) repeat wait() until loaded == true -- This will wait and prevent any functions below from running until the loaded variable becomes true plr.Character.Humanoid.Died:Connect(function() -- Changes variable back to false so it can restart the script. loaded = false end) z.Button1Down:connect(function() if loaded == true then -- This also makes sure the character is loaded before anything local v = Instance.new("BodyVelocity") v.MaxForce = Vector3.new(math.huge, math.huge, math.huge) v.Velocity = z.hit.lookVector * 100 v.Parent = plr.Character.UpperTorso end end)