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

Detecting changes on instances that have not yet spawned?

Asked by 4 years ago

How would I go on and detect changes in an instance such as an IntValue on the server which has yet not been spawned.

Basically I store my players Stamina in an IntValue which is located in ServerStorage but the amount of IntValue's always change due to players leaving and joining. So how would I detect a change in that from another script on the server that was there since the server started.

I was planning on putting a script in the intvalue when I spawn it in as the player joins the game which detects changes and then evokes a bindable event which can be then used by my other script.

2 answers

Log in to vote
0
Answered by 4 years ago

You could probably try putting this in a server script or something

IntValue:GetPropertyChangedSignal("Value"):connect(function()
BindableEvent:Fire() --put arguments here if required
-- can put more code here before the 'end)'
end)
Ad
Log in to vote
0
Answered by 4 years ago

Let me just say that what your asking is very unclear and this is what I assume ur asking for.

local folder = game.ServerStorage:WaitForChild("FolderofIntvalues")
folder.ChildAdded:Connect(function(Intval)
    Intval.Changed:Connect(function(newval)
        print('look at the end of code')
    end)
end)
print('let me put a big fat watermark')
--made by tim i bet you'll delete

Answer this question