Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

String Value wont change in script. No error?

Asked by 5 years ago

Self explanatory.

local str = "Programmer"
game:GetService("Players").PlayerAdded:Connect(function(plr)
     if plr.TeamColor == BrickColor.New("Lapis") then
        plr.leaderstats.Job.Value = str
else
    print("Hi")
     end
end)
0
Does "Hi" print? Is this a server or a local script? User#22604 1 — 5y

3 answers

Log in to vote
0
Answered by
HaveASip 494 Moderation Voter
5 years ago
Edited 5 years ago

Idk why it isnt working. Maybe try this method

local str = "Programmer"
local Team = game:GetService("Teams"):WaitForChild("Your-Team-Name") --put here ur team name

game:GetService("Players").PlayerAdded:Connect(function(plr)
    if plr.Team == Team then
        plr.leaderstats.Job.Value = str
    else
        print("Hi")
    end
end)

I always use this method(maybe it working more properly)

0
Doesent work. CoreMcNugget 15 — 5y
0
You should explain why your method works and his doesn't instead of "copy paste this man it'll work" User#22604 1 — 5y
0
I said "(maybe it working more properly)". idk what method is better HaveASip 494 — 5y
Ad
Log in to vote
0
Answered by
worklok -24
5 years ago

check if the script is disabled, and make sure you set the teamcolor exactly the same value as lapis

Log in to vote
-3
Answered by 5 years ago

I think the problem is that you do NOT set the TeamColor for the player...

Answer this question