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

how can i fix the script so when i have 100 money a brick changes colour?

Asked by 4 years ago

it a local script only 1 people can see i think so that fine yes my grammer is bad becousi i no yes ingliss

while true do
local plr = game.Player.LocalPlayer
if plr.WaitForChild("leaderstats").Money.Value = 100 then
workspace.ButtonModel.Color = Color.new("Pastel Blue")
end
end
1
You have a few mistake, I’ll see what I can do. raid6n 2196 — 4y
1
ok ty ProbablyRiley 0 — 4y

2 answers

Log in to vote
1
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Hello, ProbablyRiley.

I see a few errors.

Explanation after the script


while true do local plr = game.Player.LocalPlayer if plr.WaitForChild("leaderstats”).Money.Value = 100 then workspace.ButtonModel.BrickColor == BrickColor.new("Pastel Blue") end end

at line 3 you forgot ==, and in line 4 you forgot brick color but did color instead

1
ill try it thaks ProbablyRiley 0 — 4y
1
doesnt work ProbablyRiley 0 — 4y
0
What’s the output? raid6n 2196 — 4y
1
money isnt a valid member of leaderstats ProbablyRiley 0 — 4y
View all comments (6 more)
0
You have a value of the currency, right? raid6n 2196 — 4y
1
yes its name is money ProbablyRiley 0 — 4y
1
then it should work, are you sure? raid6n 2196 — 4y
1
oh wait the other script for leaderstats is disabled ProbablyRiley 0 — 4y
1
now it works tysm ProbablyRiley 0 — 4y
0
have a good day raid6n 2196 — 4y
Ad
Log in to vote
1
Answered by
Azarth 3141 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

Optimized version, since you don't need a loop.


-- Index static variables outside of function local localPlayer = game.Players.LocalPlayer local leaderstats = localPlayer:WaitForChild('leaderstats') local ButtonModel = workspace:WaitForChild("ButtonModel") -- Anyonymous function checks for Value changing leaderstats:GetPropertyChangedSignal("Value"):Connect(function() -- == compares, = sets if leaderstats.Value == 100 then -- BrickColor, not Color. ButtonModel.BrickColor == BrickColor.new("Pastel Blue") end end)

Answer this question