Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

mouse1down not firing but scripts and remote event working??

i am using a tool in starterpack, and from console or anything, everything works except mouse1down is technically not firing

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
script.Parent.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()
		script.Parent.RemoteEvent:FireServer(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z)
	end)
end)

i tried any fix, but every else was because it was in workspace

2 comments

0

Have you tried putting the remote event in replicated storage? Reading the documentation might help you https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

0

bro i said from console they worked LOL

1 answer

If you use a console while the game is not running some services haven't replicated their contents yet. When you start a game every player gets a copy of the tool and so many events are created in Players.LocalPlayer.Backpack.Tool. The script in the tool in starterpack will never be used so it can never fire or be called. Put your remote event in replicated storage and a local script in your tool and see if it helps. No need to be rude.

This worked for me:

Put the remote event in: game.ReplicatedStorage

Put a script wherever you want, I put mine in game.ServerScriptService

server script:

x = game.ReplicatedStorage.RemoteEvent


x.OnServerEvent:Connect(function()
	print("got msg")
end)

local script inside tool:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
script.Parent.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()
		game.ReplicatedStorage.RemoteEvent:FireServer(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z)
	end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.