Ok, so Sprint isnt something that is only available for people who own it, its just you want to wait for it to get the data from the datastore before being enabled?
yep. The issue is that doing the disabling in script could mean that the script is enabled for long enough to bug the player out.
Server Code
game.Players.PlayerAdded:Connect(function(plr)
local stamDataStore = Datastore2("stamMax",plr)
local function maxUpdate(updatedValue)
plr:SetAttribute("stamMax", stamDataStore:Get(updatedValue) )
end
maxUpdate(defaultValue)
stamDataStore:OnUpdate(maxUpdate)
plr:SetAttribute("stamCurrent",plr:GetAttribute("stamMax"))
plr:SetAttribute("SprintReady",true)
end)
Client Code (Inside the sprint script at top have)
while not game.Players.LocalPlayer:GetAttribute("SprintReady") do task.wait() end
1 Like
ok that works too. Less process heavy solution so gonna give that the solution check instead.
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.