I am writing code for a simple rocket launcher, but, as soon as i click it, it throws "This mouse is no longer active" on the console. Heres my code:
tool.Equipped:Connect(function(m) tool.Activated:Connect(function() local targ = m.Hit local p = script.Parent.Parent.bam local part = Instance.new("Part") part.Name = "boom" part.CFrame = p.CFrame * CFrame.new(-1,0,0) part.Parent = workspace local target = Instance.new("Part") target.Position = targ target.Parent = workspace local ropor = Instance.new("RocketPropulsion") ropor.Parent = part ropor.Target = target ropor:Fire() end) end)
Help?
If you're using a Server Sided Script try using a remote and send Mouse.Target through said remote. If you're using a Client Sided Script (Local Script) just index the mouse.
local player = game.Players.LocalPlayer local mouse = player:GetMouse() --All of your other code
With the server, you are supposed to send the mouse.Target through a remote.Get the Mouse.Target from the client MouseTarget
if you did this it should look like this,
local remote -- Get Your Remote remote.OnServerEvent:Connect(function(player, MouseTarget) -- ur code //make sure to make the target the MouseTarget end)
Btw, the reason you would use Mouse.Target is it gets any object located where the mouse is