Ive been at this for about a few hours now. A name GUI ive been working on just refuses to work. I know the client-side script works because it prints to the developer console in-game. The server-side script doesn't print anything, not even at the start.
Client;
script.Parent.MouseButton1Down:Connect(function() local player = game.Players.LocalPlayer local takeme = script.Parent local parto = player.Character.Part local rm = game.ReplicatedStorage.RemoteEvent wait(.1) rm:FireServer(player,parto,takeme) print 'fired!' end)
Server;
local rm = game.ReplicatedStorage.RemoteEvent rm.OnServerEvent:Connect(function(player,parto,takeme) print 'does it print?' local player = game.Players.LocalPlayer local takeme = script.Parent local parto = player.Character:WaitForChild("Part") if parto then print 'part recognised' local parta = player.Character.Part local nyee = parta.BillboardGui.NAME nyee.Text = (nyee.Text.. " | ") print 'text applied' end end)
There's a custom part inside the player, which includes a BillboardGUI. The script should add a " | " symbol to the existing text of the Textbutton inside the BillboardGUI.
LocalScript
. You're adding an extra argument to FireServer
. Remove the player
argument, and it should work.On the server side, you can't do "LocalPlayer" because the code is not in any player. Instead, you have to use the "player" parameter in the global script.
Also, while using "FireServer", you don't need to define the player again because it automatically does that.
so when you do this on the local script:
rm:FireServer(player,parto,takeme)
you have to do:
rm.OnServerEvent:Connect(function(player,player,parto,takeme)
or you can just not add the "player" parameter in the local script.
Also, you have another mistake in the global script which is: "local takeme = script.Parent". In the global script, script.Parent is no longer takeme and why are you defining it again? On the Server Side, you can't and don't need to define local stuff.
Here are the full fixed codes:
Local Script:
local takeme = script.Parent local rm = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") takeme .MouseButton1Down:Connect(function() local parto = player.Character.Part rm:FireServer(parto, takeme) print("Fired Server") end)
Global Script:
local rm = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") rm.OnServerEvent:Connect(function(player, parto, takeme) print("Server Got Signal") if parto then print("Part Recognised") local nyee = parto.BillboardGui.NAME --It would be better if you changed this, since "Name" is also a property of the BillboardGui class. nyee.Text = (nyee.Text.. " | ") print("Text Changed") end end)