I have this function that is supposed to set a players Magic value to a string, but it says player is a Number value.
function gameStart(player) if player then player.Stats.Magic = script.Parent.Parent.Parent.MagicFrame.Spinner.TextButton.Text script.Parent.Parent.Parent.Parent:Destroy() end end script.Parent.MouseButton1Down:connect(gameStart)
attempt to index local 'player' (a number value)
Please help!
Because when dealing with Player Guis
you should always use a Local Script
, we can get the player using Local Player
.
local player = game.Players.LocalPlayer function gameStart(mouse) player.Stats.Magic = script.Parent.Parent.Parent.MagicFrame.Spinner.TextButton.Text script.Parent.Parent.Parent.Parent:Destroy() end script.Parent.MouseButton1Down:connect(gameStart)
Good Luck!