✓ Accepted answer
If this is not in a local script then that is the problem. It must be in a local script. If it is in a local script, here is why it is not working:
script.Parent.confirm.MouseButton1Click:connect(function(player)
game.ReplicatedStorage.GiveRoom:FireServer(player)
end)
A local script does not need to detect the player that clicked a button when the only player that could have is it's client, so you do not need the player argument.
It should look like this: (also remember to use :Connect because :connect is deprecated)
script.Parent.confirm.MouseButton1Click:Connect(function()
game.ReplicatedStorage.GiveRoom:FireServer()
end)
And in the server: (example script)
game.ReplicatedStorage.GiveRoom.OnServerEvent:Connect(function(player)
end)
Note that the event function still has the player argument, because the first argument in any remote event or function server side is always the player it came from, if you want to get data from the client do it like this:
(EXAMPLE)
game.ReplicatedStorage.GiveRoom.OnServerEvent:Connect(function(player,data)
print(player.." said: "..data);
end)
And call it like this from a client:
script.Parent.confirm.MouseButton1Click:Connect(function()
game.ReplicatedStorage.GiveRoom:FireServer("Hello World!");
end)
4 comments
weird, i tried using mousebutton1click for my game, and it worked. are you sure you're using a localscript?
What do you mean, filtering enabled doesn't affect mouse related events if ur using it properly.
FilteringEnabled has nothing to do with this. It is most likely a problem with your RemoteEvent.
I'm assuming this is a BillboardGui or a SurfaceGui, if you're having issues with it. You'll need to use
Adornee, if this is the problem.