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

Why won't my IntValue change and affect the part? [Answered]

Asked by 4 years ago
Edited by Ziffixture 4 years ago

You see, I have added an IntValue in ServerStorage, and used this script in a Part in workspace:

local part = workspace.Part
part.Touched:Connect(function()
game.ServerStorage.IntValue.Value = 1
if game.ServerStorage.IntValue.Value==1 then
part.Color = BrickColor.new("Really red")
end
end)

1 answer

Log in to vote
3
Answered by
Slatryte 104
4 years ago

Instead, try this:

local part = workspace.Part
part.Touched:Connect(function()
game.ServerStorage.IntValue.Value = 1
game.ServerStorage.IntValue.Changed:Connect(function()
if game.ServerStorage.IntValue.Value==1 then
part.Color = BrickColor.new("Really red")
end
end
end)
1
Thanks! RealLionie -73 — 4y
Ad

Answer this question