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

player value not resopding to a script why???

Asked by
hokyboy 270 Moderation Voter
6 years ago

game.Players.PlayerAdded:connect(function(p) local stats = Instance.new("IntValue", p) stats.Name = "leaderstats" local money = Instance.new("StringValue", stats) money.Name = "test" money.Value = "gunA"

if game.Players.LocalPlayer.leaderstats.test == "gunA" then game.Workspace.Baseplate.Color = BrickColor.White() end end)

the brick color does not change and no output of the studio??? why is this and how to fix this?

1
Use a code block. farrizbb 465 — 6y

1 answer

Log in to vote
3
Answered by 6 years ago

You're trying to compare the test stringValue to "gunA". You should be checking the value instead, so this line:

if game.Players.LocalPlayer.leaderstats.test == "gunA" then

should be

if game.Players.LocalPlayer.leaderstats.test.Value == "gunA" then 
0
^ Elixcore 1337 — 6y
Ad

Answer this question