Hello!,
I have an IntValue inside ReplicatedStorage for purposes. I wanted to simply destroy (remove) a model inside the workspace and replace another model on that specific position.
local donate = game.ReplicatedStorage.TotalDonation
local total = donate.Value
if total.Value >= 1000000 then -- greater than equal a million?
local donation = game.Workspace.DonationStation
donation:Destroy()
wait()
local rich = game.ReplicatedStorage.MrRich
rich.Parent = workspace
end
local donate = game.ReplicatedStorage.TotalDonation
local total = donate.Value
donate:GetPropertyChangedSignal("Value"):Connect(function()
if total.Value >= 1000000 then -- greater than equal a million?
local donation = game.Workspace.DonationStation
donation:Destroy()
wait()
local rich = game.ReplicatedStorage.MrRich
rich.Parent = workspace
end
end)
You need to Check when the Value changes.
The Script only checks once so it wont run further on.
Here i use GetPropertyChangedSignal.
This Detects when the Value changes and Destroys the model.