actually this makes me think
localscripts run whenever a player joins the game so you could just say GUI.TEXT = NAME with no problems
actually this makes me think
localscripts run whenever a player joins the game so you could just say GUI.TEXT = NAME with no problems
Ok, do you know what a LocalScript is? If not itās a script that runs on the client (each players machine). Itās meant to handle all āclient thingsā. Do to the fact itās on the client, the person can technically change any script or any value which is why you never trust values from the client.
In the second option you simply make a local script in StarterPlayerScripts (or any client container)
-- local script
local newTemplate = tradingTemplate:Clone()
newTemplate.Parent = script.Parent -- this would be good if the localscript was inside a ScreenGui
newTemplate:WaitForChild("playerName").Text = player.Name
This code will run independently for each player, the server canāt access it and the other clients canāt access it.
would it show every players name? And wouldnāt it run only once?
it would run for each player silly
No anything done on the client does not replicate to the server, if you want something to replicate to all the clients you either
i tried that, but it didnāt work. It only showed their own name not everyones
game.Players.PlayerAdded:Connect(function(player)
Remotes.ShowForAllClients:FireAllClients(player)
end)
RP.Remotes.ShowForAllClients.OnClientEvent:Connect(function()
local newTemplate = tradingTemplate:Clone()
newTemplate.Parent = script.Parent
newTemplate:WaitForChild("playerName").Text = player.Name
end)
yea I can see where you messed up with this
ill let elon explain this
If you are making an overhead Gui (like a billboard Gui in the workspace), in this case it makes the most sense to do it on the server.
On the client script you posted you donāt take into account the player object that gets passed through the RemoteEvent, you want to place the GUI in each player character.
RP.Remotes.ShowForAllClients.OnClientEvent:Connect(function(player)
local newTemplate = tradingTemplate:Clone()
newTemplate.Parent = player.Character --
newTemplate:WaitForChild("playerName").Text = player.Name
end)
For this case I would do
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
-- put a billboardGui in Player.Character
local billboard = ReplicatedStorage.template:Clone()
billboard.Parent = player.Character
end)
end)
Even though itās technically handling a GUI on the server, I still think itās better because the server replicates the workspace anyway.
maybe a pro will come and say Iām wrong but I donāt think so
No because if a player joins it fires the function again
Um I donāt think you are fully up to date on the situation. We are talking about a local script.
@NotZylon refer to my last post
lol
itās not a billboardgui though, itās just a frame
I already knew that hehehehehehe
Well then do it however you like,
Overhead GUIās are usually billboard guiās (I think they always are)
@D0RYU pog
Oh ok sorry just got here lol my bad man
nothing to be sorry for
if ur busy then ur busy
(Cant like need to wait 1 hour lol)
but im not sure what i did wrong
Can you send the code so I can see it?
wait what is the current script or scripts you are using for it rn
RP.Remotes.ShowForAllClients.OnClientEvent:Connect(function()
local newTemplate = tradingTemplate:Clone()
newTemplate.Parent = script.Parent
newTemplate:WaitForChild("playerName").Text = player.Name
end)
game.Players.PlayerAdded:Connect(function(player)
Remotes.ShowForAllClients:FireAllClients(player)
end)