I am trying to make it where every time inround == false.
local function loadPlayerData(player)
local key = "Player_" .. player.UserId
local success, data = pcall(function()
return dataStore:GetAsync(key)
end)
if success and data ~= nil then
player.leaderstats.Cash.Value = data
end
end
-- Function to initialize leaderstats for a player
local function initializeLeaderstats(player)
-- Create leaderstats folder
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
-- Create Cash value
local cash = Instance.new("NumberValue")
cash.Name = "Cash"
cash.Value = 500
cash.Parent = leaderstats
end
-- Connect the functions to player events
game.Players.PlayerAdded:Connect(function(player)
initializeLeaderstats(player)
loadPlayerData(player)
end)
This is what makes the cash.
I made an inround value to check if the inround is false.
And if it is this script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local InRound = ReplicatedStorage:WaitForChild("InRound")
local player = game.Players.LocalPlayer
if InRound.Value == false then
local msg = Instance.new("Message", workspace)
msg.Text = "Rewarded 150 Cash!"
local leaderstats = player:WaitForChild("leaderstats")
local cash = leaderstats:WaitForChild("Cash")
cash.Value = cash.Value + 150
else
error("Can't find the player cash!")
end
Is meant to add +150 cash.
It won’t do so?
Heres a video too
Can anyone help?
