This mouse is no longer active

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    To make it where it hits where its supposed to

  2. What is the issue? Include screenshots / videos if possible

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i couldn’t find any related to it
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!


--Server script


sp=script.Parent
local equipped

UISF = sp:WaitForChild("UISF")

local cooldown=10
local jetheight=200
local jetdistance=2000
local jetspeed=300
local talkinggrip=CFrame.new(-1.5,-.5,.65)*CFrame.Angles(-.2,3.14159,0)
local holdinggrip=CFrame.new(0,-.35,.1)*CFrame.Angles(.4,-.9,0)


local debris=game:GetService("Debris")
local check=true
local laststrike=sp:WaitForChild("LastStrike")
local dodgeballscript=sp.ScriptHandler:WaitForChild("DodgeballScript")

local function createdodgeball(pos,velocity)
	local p=Instance.new("Part")
	p.Name="Dodgeball"
	p.Material="Concrete"
	p.BrickColor=BrickColor.new(math.random()>.5 and "Bright red" or "Bright blue")
	p.Elasticity=1
	p.CanCollide=true
	p.Locked=true
	p.TopSurface="Smooth"
	p.BottomSurface="Smooth"
	p.formFactor="Custom"
	p.Shape="Ball"

	local sound=Instance.new("Sound")
	sound.SoundId="http://www.roblox.com/asset/?id=112503990"
	sound.Parent=p

	local creatortag=Instance.new("ObjectValue")
	creatortag.Value=game.Players.LocalPlayer
	creatortag.Name="creator"
	creatortag.Parent=p

	local s=sp.ScriptHandler.DodgeballScript:clone()
	s.Parent=p
	s.Disabled=false

	p.Size=Vector3.new(3,3,3)
	p.CFrame=CFrame.new(pos)
	p.Velocity=velocity
	debris:AddItem(p,3)
	p.Parent=game.Workspace
end

function onEquipped(mouse)
	equipped=true
	
	sp.Grip=holdinggrip
		if tick()-cooldown<laststrike.Value then
			mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
			wait(laststrike.Value-(tick()-cooldown))
			mouse.Icon="rbxasset://textures\\GunCursor.png"
		else
			mouse.Icon="rbxasset://textures\\GunCursor.png"
		end
		script.Parent.Activated:Connect(function()
			if tick()-cooldown>laststrike.Value and mouse.Target and mouse.Target~=nil and mouse.Hit then
				local location= UISF:InvokeClient(mouse.Hit.p)
				local chr=sp.Parent
				if chr and check then
					local t=chr:FindFirstChild("Torso")
					local h=chr:FindFirstChild("Humanoid")
					if t and h and h.Health>0 then
						check=false
						laststrike.Value=tick()
						mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
						sp.Grip=talkinggrip
						local sound=sp.Handle:FindFirstChild("Sound")
						if sound~=nil then
							sound:Play()
						end

						local tp=Instance.new("Part")
						tp.Transparency=.5
						tp.Name="Effect"
						tp.Anchored=true
						tp.CanCollide=false
						tp.Size=Vector3.new(0,0,0)
						tp.BrickColor=BrickColor.new("Really red")
						tp.CFrame=CFrame.new(location)*CFrame.Angles(math.pi/2,0,0)
						local me=Instance.new("SpecialMesh")
						me.MeshId="http://www.roblox.com/asset/?id=3270017"
						me.Scale=Vector3.new(10,10,1)
						me.Parent=tp
						debris:AddItem(tp,5)
						tp.Parent=game.Workspace
						delay(0,function()
							while tp and tp.Transparency<1 do
								tp.Transparency=tp.Transparency+.025
								wait(.15)
							end
							if tp then
								tp:remove()
							end
						end)

						delay(3,function()
							for i=1,30 do
								local startpos=location+Vector3.new((math.random()-.5)*100,5+50*math.random(),(math.random()-.5)*100)
								local vec=(location+Vector3.new(0,15,0)-startpos).unit
								createdodgeball(startpos,vec*(60+math.random()*70))
								wait(.2)
							end
						end)

						wait(2)
						local sound=sp.Handle:FindFirstChild("Sound")
						if sound~=nil then
							sound:Stop()
						end
						sp.Grip=holdinggrip
						wait(cooldown-2)
						mouse.Icon="rbxasset://textures\\GunCursor.png"
						check=true
					end
				end
			end
		end)
	end


function onUnequipped()
	equipped=false
end

sp.Equipped:connect(onEquipped)
sp.Unequipped:connect(onUnequipped)
local Variables
local Game = game
local Script = script
local Tool = Script.Parent



--Variables
    UIS = Game:GetService("UserInputService")
    UISF = Tool:WaitForChild("UISF")
--Code
function UISF.OnClientInvoke()
	return game.Players.LocalPlayer:GetMouse().Hit.p
end


Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

from what I see you need to change over all mouse controls to your local script not the server script then like you do on that remote for position send over for server to use if needed

you can setup the same equip function and set icon etc as you need but i would declare the mouse at top of the local script with

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

? didnt i already do InvokeServer to try to get mouse.Hit.p?

right but your probably getting the error trying to access the mouse on the server script to just change the icons etc

so if i move the icons line somewhere else and it should work?

yeah I think so if you move all them to the local script it should fix the issue if I am understanding how you have the scripts setup

still doesnt work moved every mouse stuff i could find in a local script
and it still throws me the same error

--Server

local Variables
local Game = game
local Script = script
local Tool = Script.Parent
local equipped
local sp = Tool

UISF = sp:WaitForChild("UISF")

local cooldown=10
local jetheight=200
local jetdistance=2000
local jetspeed=300
local talkinggrip=CFrame.new(-1.5,-.5,.65)*CFrame.Angles(-.2,3.14159,0)
local holdinggrip=CFrame.new(0,-.35,.1)*CFrame.Angles(.4,-.9,0)


local debris=game:GetService("Debris")
local check=true
local laststrike=sp:WaitForChild("LastStrike")
local dodgeballscript=sp:WaitForChild("DodgeballScript")

local function createdodgeball(pos,velocity)
	local p=Instance.new("Part")
	p.Name="Dodgeball"
	p.Material="Concrete"
	p.BrickColor=BrickColor.new(math.random()>.5 and "Bright red" or "Bright blue")
	p.Elasticity=1
	p.CanCollide=true
	p.Locked=true
	p.TopSurface="Smooth"
	p.BottomSurface="Smooth"
	p.formFactor="Custom"
	p.Shape="Ball"

	local sound=Instance.new("Sound")
	sound.SoundId="http://www.roblox.com/asset/?id=112503990"
	sound.Parent=p

	local creatortag=Instance.new("ObjectValue")
	creatortag.Value=game.Players.LocalPlayer
	creatortag.Name="creator"
	creatortag.Parent=p

	local s=sp.DodgeballScript:clone()
	s.Parent=p
	s.Disabled=false

	p.Size=Vector3.new(3,3,3)
	p.CFrame=CFrame.new(pos)
	p.Velocity=velocity
	debris:AddItem(p,3)
	p.Parent=game.Workspace
end

function onEquipped(mouse)
	equipped=true
	

		script.Parent.Activated:Connect(function()
			
				local location= UISF:InvokeClient(mouse.Hit.p)
				local chr=sp.Parent
				if chr and check then
					local t=chr:FindFirstChild("Torso")
					local h=chr:FindFirstChild("Humanoid")
					if t and h and h.Health>0 then
						check=false
						laststrike.Value=tick()
						
						sp.Grip=talkinggrip
						local sound=sp.Handle:FindFirstChild("Sound")
						if sound~=nil then
							sound:Play()
						end

						local tp=Instance.new("Part")
						tp.Transparency=.5
						tp.Name="Effect"
						tp.Anchored=true
						tp.CanCollide=false
						tp.Size=Vector3.new(0,0,0)
						tp.BrickColor=BrickColor.new("Really red")
						tp.CFrame=CFrame.new(location)*CFrame.Angles(math.pi/2,0,0)
						local me=Instance.new("SpecialMesh")
						me.MeshId="http://www.roblox.com/asset/?id=3270017"
						me.Scale=Vector3.new(10,10,1)
						me.Parent=tp
						debris:AddItem(tp,5)
						tp.Parent=game.Workspace
						delay(0,function()
							while tp and tp.Transparency<1 do
								tp.Transparency=tp.Transparency+.025
								wait(.15)
							end
							if tp then
								tp:remove()
							end
						end)

						delay(3,function()
							for i=1,30 do
								local startpos=location+Vector3.new((math.random()-.5)*100,5+50*math.random(),(math.random()-.5)*100)
								local vec=(location+Vector3.new(0,15,0)-startpos).unit
								createdodgeball(startpos,vec*(60+math.random()*70))
								wait(.2)
							end
						end)

						wait(2)
						local sound=sp.Handle:FindFirstChild("Sound")
						if sound~=nil then
							sound:Stop()
						end
						sp.Grip=holdinggrip
						wait(cooldown-2)
			
						check=true
					end
				end
			end)
	end


function onUnequipped()
	equipped=false
end

sp.Equipped:connect(onEquipped)	
sp.Unequipped:connect(onUnequipped)
	
	



Its probably the server script referencing to it in the equipped(mouse) function. Also you probably should move the activated function outside of the equipped function else you will get multi connections

could you send a fuller screenshot of the whole error message? Even the blue parts that come under it. send it while using the exact same script you sent in the post. So the line numbers are the same.

Its all usefull info for debugging

? i sended the whole error message if your talking about the damage script for the parts that’s just a damage script and it doesn’t connect with the other scripts

In your local script at the top. Declare your mouse.

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Then change this line 
game.Players.LocalPlayer:GetMouse().Hit.p

To 
Mouse.Hit.p


I think the issue maybe when the event fires its trying to pull the mouse object.  But its not there

still nothing i guess and its still throwing the same error, its also saying in the server script in roblox studio

Unknown global Mouse and its because in the function Onequipped(Mouse) I removed that Mouse in the ()

You should probably move this activated connection outside the onequipped. But also. This line is still referencing to the mouse.
UISF:InvokeClient(mouse.Hit.p)

i did do that i swear hold on ill show you in a sec



sp = script.Parent
Sp = script.Parent
Sp = sp
Tool = Sp
UISF = Tool:WaitForChild("UISF")
local equipped

local cooldown=10
local jetheight=200
local jetdistance=2000
local jetspeed=300
local talkinggrip=CFrame.new(-1.5,-.5,.65)*CFrame.Angles(-.2,3.14159,0)
local holdinggrip=CFrame.new(0,-.35,.1)*CFrame.Angles(.4,-.9,0)


local debris=game:GetService("Debris")
local check=true
local laststrike=sp:WaitForChild("LastStrike")
local dodgeballscript=sp:WaitForChild("DodgeballScript")

local function createdodgeball(pos,velocity)
	local p=Instance.new("Part")
	p.Name="Dodgeball"
	p.Material="Concrete"
	p.BrickColor=BrickColor.new(math.random()>.5 and "Bright red" or "Bright blue")
	p.Elasticity=1
	p.CanCollide=true
	p.Locked=true
	p.TopSurface="Smooth"
	p.BottomSurface="Smooth"
	p.formFactor="Custom"
	p.Shape="Ball"

	local sound=Instance.new("Sound")
	sound.SoundId="http://www.roblox.com/asset/?id=112503990"
	sound.Parent=p

	local creatortag=Instance.new("ObjectValue")
	creatortag.Value=game.Players.LocalPlayer
	creatortag.Name="creator"
	creatortag.Parent=p

	local s=dodgeballscript:clone()
	s.Parent=p
	s.Disabled=false

	p.Size=Vector3.new(3,3,3)
	p.CFrame=CFrame.new(pos)
	p.Velocity=velocity
	debris:AddItem(p,3)
	p.Parent=game.Workspace
end

Tool.Activated:Connect(function()


function onEquipped()
	equipped=true
		sp.Grip=holdinggrip
		
		local location=UISF:InvokeClient(Mouse.Hit.p)
				local chr=sp.Parent
				if chr and check then
					local t=chr:FindFirstChild("Torso")
					local h=chr:FindFirstChild("Humanoid")
					if t and h and h.Health>0 then
						check=false
						laststrike.Value=tick()
						sp.Grip=talkinggrip
						local sound=sp.Handle:FindFirstChild("Sound")
						if sound~=nil then
							sound:Play()
						end

						local tp=Instance.new("Part")
						tp.Transparency=.5
						tp.Name="Effect"
						tp.Anchored=true
						tp.CanCollide=false
						tp.Size=Vector3.new(0,0,0)
						tp.BrickColor=BrickColor.new("Really red")
						tp.CFrame=CFrame.new(location)*CFrame.Angles(math.pi/2,0,0)
						local me=Instance.new("SpecialMesh")
						me.MeshId="http://www.roblox.com/asset/?id=3270017"
						me.Scale=Vector3.new(10,10,1)
						me.Parent=tp
						debris:AddItem(tp,5)
						tp.Parent=game.Workspace
						delay(0,function()
							while tp and tp.Transparency<1 do
								tp.Transparency=tp.Transparency+.025
								wait(.15)
							end
							if tp then
								tp:remove()
							end
						end)

						delay(3,function()
							for i=1,30 do
								local startpos=location+Vector3.new((math.random()-.5)*100,5+50*math.random(),(math.random()-.5)*100)
								local vec=(location+Vector3.new(0,15,0)-startpos).unit
								createdodgeball(startpos,vec*(60+math.random()*70))
								wait(.2)
							end
						end)

						wait(2)
						local sound=sp.Handle:FindFirstChild("Sound")
						if sound~=nil then
							sound:Stop()
						end
						sp.Grip=holdinggrip
						wait(cooldown-2)
						mouse.Icon="rbxasset://textures\\GunCursor.png"
						check=true
					end
				end
			end
	end)


function onUnequipped()
	equipped=false
end

sp.Equipped:Connect(onEquipped)
sp.Unequipped:Connect(onUnequipped)


@Nyonic can Tool. Activated be empty?

The activated function can be empty. But this function is when the player clicks it does what you want. Else if you have all that in the equipped it will do it when the player equips the tool

You can put the activated in equipped but if you do use a connection so you can disconnect the activated function. In the unequip

so should i remove Tool.Activated?

No you need it for when they use the tool i would just put it on outside of the equipped function. Most times i set this up in local script

so should i add Mouse back in the ()?
function onEquipped()