wait(2)
Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Ducat
function onClick()
if Cash.Value >= 4 then
Cash.Value = Cash.Value - 4
local RockLaunch = script.Parent.Parent.Items.Sword:clone()
RockLaunch.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
end
end
script.Parent.MouseButton1Click:connect(onClick)
Hello, thank you for reading. So imagine this is in a script in a GUI. When it get's to the fifth Parent, it is now at the hierarchy of Players or the "Player"(example: Player1) himself. I put in a script where when a new player enters, they get a IntValue which is named "leaderstats" and within leaderstats is another IntValue that is called "Ducat".
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local cash = Instance.new("IntValue")
cash.Name = "Ducat"
cash.Value = 0
cash.Parent = stats
stats.Parent = newPlayer
end
game.Players.PlayerAdded:connect(onPlayerEntered)
The problem here is that the studio won't recognize leaderstats in the workspace even though it clearly shows that leaderstats is part of the "Player1" himself.
This is what it says leaderstats is not a valid member of Player.
If anyone can tell me why it doesn't recognize the leaderstats, even though the leaderstats is clearly there, I would highly appreciate it.
