Hi,
There seems to be something wrong with this script. I get no errors from the output.
--Function call(Values)--
game.Players.PlayerAdded:Connect(function(player)
--Folder--
local PlayerStats = Instance.new("Folder")
PlayerStats.Name = "PlayerStats"
PlayerStats.Parent = player
--Level amount--
local LevelValue = Instance.new("NumberValue")
LevelValue.Name = "LevelAmount"
LevelValue.Parent = PlayerStats
--Cash amount--
local CashValue = Instance.new("NumberValue")
CashValue.Name = "CreditsAmount"
CashValue.Parent = PlayerStats
CashValue.Value = 0
--Function call(Add cash when killed)--
player.CharacterAdded:Connect(function(Character)
Character.Humanoid.Died:Connect(function(Died)
local creator = Character.Humanoid:FindFirstChild("creator")
local PlayerStats = creator:FindFirstChild("PlayerStats")
if creator ~= nil and creator.Value ~= nil then
PlayerStats.CreditsAmount.Value = PlayerStats.CreditsAmount.Value + 500
end
end)
end)
end)
If there nothing wrong with the script then there’s probably something wrong with 5his script thats in the text label that shows the amount of cash.
local player = game.Players.LocalPlayer
player:WaitForChild("PlayerStats").CreditsAmount.Changed:Connect(function(val)
script.Parent.Text = "Credits: "..val
end)
script.Parent.Text = "Credits: "..player:WaitForChild("CreditsAmount").Value
everything is a server script besides the text label one which is local.
from,
File