I have been working on a ServerScript thats inside a part named "Handle", and the handle is inside a tool (the tool being in StarterPack). I made the script a ServerScript because the game is FilteringEnabled. Here's the code:
tool = script.Parent.Parent
hand = script.Parent
LOADED = 1
plr = script.Parent.Parent.Parent.Parent
m = plr:GetMouse()
toole = false
tool.Equipped:connect(function()
tool = true
end)
tool.Unequipped:connect(function()
tool = false
end)
m.Button1Down:connect(function()
if LOADED == 1 and tool == true then
LOADED = LOADED - 1
script.Sound:Play()
a = plr.Character.Humanoid:LoadAnimation(script.Animation)
a:Play()
wait(0.8)
LOADED = LOADED + 1
end
end)
m.KeyDown:connect(function(key)
key = key:lower()
if key == "q" and LOADED == 1 and tool == true then
LOADED = LOADED - 1
script.ignite:play()
local pe = workspace.pepart2.ParticleEmitter:clone()
pe.Parent = hand.Attachment
local lite = Instance.new("PointLight",script.Parent.Attachment)
wait(6.5)
lite:remove()
pe:remove()
wait(3)
LOADED = LOADED + 1
end
end)
It works in studio, although when tested in a server, it stumbles upon an error, "attempt to index "m" (the mouse variable), a nil value.
I hope you guys can help me out, thanks!
