Im using the “ProfileService” as my Database. Im trying to update a textLabel to the Currencies Value but im not sure if this script is good.
The scripts parent is the TextLabel
local PlayerDataHandler = require(game.ServerScriptService:WaitForChild("PlayerDataHandler"))
local rs = game:GetService("RunService")
local Players = game:GetService("Players")
local player = script.Parent.Parent.Parent.Parent.Parent.Parent
rs.Stepped:Connect(function()
PlayerDataHandler:Update(player, "Coins", function(CurrentCoins)
script.Parent.Text = CurrentCoins
return(CurrentCoins)
end)
end)
dont mind the six parent.Parent line, thats only way I thought of getting the player from a server script.
It works fine (for now) and if theres a better method of doing this or getting the player then please let me know :D, Thanks!