I am trying to make a team changer where you hit the job and ui pop up. Then if you hit get tag it. switches your team to that job.
All of this works accept the tag does not change. It will only appear on the client’s side, not for the whole server.
I think I need to be using a remote event to fix this. But I don’t know how. How do i do this?
This script is a normal script in StarterCharacterScripts
local char = script.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local NameTagClone = game.ServerStorage.HeadUI:Clone()
NameTagClone.Parent = char.Head
NameTagClone.Adornee = char.Head
NameTagClone.UI.NameUI.NameName.Text = char.Name
if plr.Team == nil then
NameTagClone.UI.RankUI.RankName.Text = "Player"
end
repeat wait() until plr.Team ~= nil
NameTagClone.UI.RankUI.RankName.Text = plr.Team.Name
char.Humanoid.DisplayDistanceType = "None"
game:GetService("RunService").Heartbeat:Connect(function()
NameTagClone.UI.RankUI.RankName.Text = plr.Team.Name
end)
nikos300
(niko)
August 17, 2023, 11:44am
#2
can you show the script of the team changer? also tell me where it is and what type is it (local , server)
W0_0SH
(wooshers)
August 17, 2023, 11:49am
#3
Obviously it will only appear on client, because it’s in StarterCharacterScripts
where LocalScripts
are supposed to be.
If you want to do something on the server then place a Script
(not a LocalScript
) in Workspace
or ServerScriptService
and make sure the RunContext
property of the script is set to Legacy /Server .
I know how to get the player but I dont know how to make it a server script
local char = game:GetService("Players")
local plr = game.Players:GetPlayerFromCharacter(char)
local NameTagClone = game.ServerStorage.HeadUI:Clone()
NameTagClone.Parent = char.Head
NameTagClone.Adornee = char.Head
NameTagClone.UI.NameUI.NameName.Text = char.Name
if plr.Team == nil then
NameTagClone.UI.RankUI.RankName.Text = "Player"
end
repeat wait() until plr.Team ~= nil
NameTagClone.UI.RankUI.RankName.Text = plr.Team.Name
char.Humanoid.DisplayDistanceType = "None"
game:GetService("RunService").Heartbeat:Connect(function()
NameTagClone.UI.RankUI.RankName.Text = plr.Team.Name
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
---> variables
local NameTagClone = game.ServerStorage.HeadUI:Clone()
---> main
NameTagClone.Parent = char.Head
NameTagClone.Adornee = char.Head
NameTagClone.UI.NameUI.NameName.Text = char.Name
if plr.Team == nil then
NameTagClone.UI.RankUI.RankName.Text = "Player"
end
repeat wait() until plr.Team ~= nil
NameTagClone.UI.RankUI.RankName.Text = plr.Team.Name
char.Humanoid.DisplayDistanceType = "None"
game:GetService("RunService").Heartbeat:Connect(function()
NameTagClone.UI.RankUI.RankName.Text = plr.Team.Name
end)
end)
end)
system
(system)
Closed
August 31, 2023, 5:51pm
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.