Hello, I’m trying to make a card tool, Which you start with when you join.
But there is a problem making in replicate between the client and the server.
I’m trying to make the card say the player ID, Name, Team Name, and age, But I only got two results:
Everyone is seeing their own info and everyone else is seeing at their card nil (Because using LocalScript)
Everyone’s card is showing one player’s info
I would really appreciate it if someone could help me.
I do not think there is a need to make anything local. Just make the script get the data from the specific user and give it to him. Everyone will be able to see it, and no card will have nil as information.
If you need help with the script you could send it too.
game.Players.PlayerAdded:Connect(function(plr)
print(script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name)
if plr == script.Parent.Parent.Parent.Parent.Parent.Parent.Parent then
script.Parent.Text = plr.Name
end
end)
I have an idea then. Just put the card in StarterPack and put a normal script inside of it. Then, connect a function that activates when the tool is equipped, that will get the player thanks to the character, and there, the info.
No, what have you done its a function that activates when the player joins, not when the tool is equipped:
In this case the script is inside the tool, not inside the part thats inside the tool
script.Parent.Equipped:Connect(function()
local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
if player then
script.Parent.Card.SurfaceGui.Text = player.Name
end
end
This script also covers if the card is dropped and other player grabs it.
I literally removed my post before you even said that
Local or Server, it should work either way, just that you don’t need to use a PlayerAdded event as that’ll fire for every Player that joins the game depending on how much players there are
--LocalScript example inside the Tool
local Player = game.Players.LocalPlayer
local Tool = script.Parent
Tool.Equipped:Connect(function()
Tool.Card.SurfaceGui.Text = Player.Name
end)
Yes i know that, what i mean is that the player will be able to see their card info, cool. But what about others cards? That player will see them as nil.