Create a variable in your script and set it to nil.
Then when the RemoteEvent is fired, set that variable you made to the RemoteEvent data you received.
When you want to use the data, check if your variable that stores it is not nil, meaning the event was fired. If it is not nil, then use that data.
Here’s a code example:
local data = nil
remote.OnServerEvent:Connect(function(myData)
data = myData
end)
if data ~= nil
doStuff()
end
Just to make sure. doStuff() is the function that I make that does stuff when data isn’t nil correct? I think this might solve my problem/question, thanks for the help I’ll see if this works!