Hello!
I am creating a simulator, Whenever I test out the tool, to actually give you points, it says “Player is not a valid member of Local Script, Workspace.dd_y09.Tool.LocalScript” Is there anyway to fix this?
Can you show the script? This error means that you’re trying to do something like
script.Player
Here is the local Script: local player = game.Players.LocalPlayer
local cd = false
script.Parent.Activated:Connect(function()
if not cd then
cd = true
game.ReplicatedStorage.Remotes.Add:FireServer(script.player.Ammount.Value)
wait (0.5)
cd = false
end
end)
And here is the main script: game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(‘Folder’, player)
leaderstats.Name = ‘leaderstats’
local coins = Instance.new('IntValue', leaderstats)
coins.Name = 'Coins'
coins.Value = 0
end)
game.ReplicatedStorage.Remotes.Add.OnServerEvent:Connect(function(player, Ammount)
local currency = ‘Coins’
player.leaderstats[currency].Value = player.leaderstats[currency].Value + Ammount
end)
Is the error coming from this line?
Yes, this is where the error is coming from.
That means that script.player doesn’t exist. What are you trying to get?
I’m trying to get someone to help, with this issue? which no one is doing.?
Ok, maybe poor phrasing on my part. What I mean was what is script.player.Ammount.Value supposed to be?
To get a local player, do the following and change all values that are supposed to equal the Local Player to this.
local Player = game.Players.LocalPlayer -- The Local Player itself,
local Character = Player.Character -- The Character of the LocalPlayer.
Edit Note:
If you need to get the player through doing a script.Parent argument, then you’ll have to continue to map it and make sure it’s actually getting the player and not another thing as it’s parent.