So, Im making a script for a fireball, but through it im struggling. When I did this a long time ago it worked fine, but now its just breaking and making me angry. It says: GetMouse is not a valid member of BackPack.
Script 1:
local Tool = script.Parent
play = game.Players.LocalPlayer
mouse = play:GetMouse()
char = play.Character
hum = char.Humanoid
local en = true
Tool.Activated:connect(function()
if not en then return end
en = false
Tool.RemoteEvent:FireServer(mouse.Hit)
wait(0.5)
en = true
end)
Script 2:
local Tool = script.Parent
play = script.Parent.Parent
local mouse = play:GetMouse()
char = play.Character
hum = char.Humanoid
local en = true
Tool.RemoteEvent.OnServerEvent:connect(function(play,mousehit)
local a = hum:LoadAnimation(Tool.Melee)
a:play()
wait(1.4)
wait(1.4)
local fireball = Tool.Handle:clone()
fireball.CFrame = Tool.Handle.CFrame
local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
bv.Velocity = mousehit.lookVector * 50
bv.Parent = fireball
fireball.CanCollide = false
fireball.Parent = game.Workspace
end)

1 comment
You cannot get the players mouse in a server script.