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

RemoteEvent wont fire and server script wont work, no errors in the console?

So, this server script won't work, No errors or anything. I want it to fire a server when a player clicks a click detector but it won't work for some reason, I'd appreciate if you would help me!

Code:

local RemoteEvent = game.ReplicatedStorage.Clothing
local Click = script.Parent
Click.MouseClick:Connect(function(Clicked)
	if Clicked.Name == game:GetService("Players").LocalPlayer then
		script.Parent.SurfaceGui.Frame.Description = Clicked.Name.."'s Avatar Booth"
		workspace.Dummy.Name = Clicked.Name
		print(Click.Name..": Claimed A Booth!")
		RemoteEvent:FireServer()
	end
end)

2 comments

0

You can only fire servers with local scripts (client scripts) that way the remote fires on the client and replicates on the server.

0

and you need a server script to handle the server event

1 answer

✓ Accepted answer

-- local

local RemoteEvent = game.ReplicatedStorage.Clothing
local Click = script.Parent

Click.MouseClick:Connect(function(Clicked)
    if Clicked.Name == game:GetService("Players").LocalPlayer then
        RemoteEvent:FireServer()
    end
end)

-- Server

local RemoteEvent = game.ReplicatedStorage.Clothing

RemoteEvent.OnServerEvent:Connect(function()
	script.Parent.SurfaceGui.Frame.Description = Clicked.Name.."'s Avatar Booth"
        workspace.Dummy.Name = Clicked.Name
        print(Click.Name..": Claimed A Booth!")
end)

Easy as that.

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