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

Remote Event not firing?

I am trying to fire a remote event when the player clicks a button but nothing is happening and I am not getting any errors.

Local Script:

local equip = workspace:WaitForChild("Remotes"):WaitForChild("EquipShaggy")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
	equip:FireServer(player,"HI")
end)

Server Script:

script.Parent.OnServerEvent:Connect(function(player,shaggy)
	print("Fired")
	local char = workspace:FindFirstChild(player.Name)
	local d = char:GetChildren()
	
	for i = 1,#d do
		if d[i]:IsA("Accessory") then
			d[i]:Destroy()
			print(d[i].Name.." succefully removed")
		end
	end
end)

2 comments

0

dont put remote events in the workspace, use replicated storage

0

you don't need to send the player object over, it is sent by default

1 answer

Okay , so you don't need to type 'player' when you're firing it because the script already knows what player is. Put the Remotes folder in ReplicatedStorage. Fixed script:

local equip = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("EquipShaggy")
script.Parent.MouseButton1Click:Connect(function()
    equip:FireServer("HI")
end)

Also , put server scripts in serverscriptservice.

1 comment

0

It is still not firing and I put a print under the MouseClick and it is detecting the click

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