I'm trying to make it so that when the button is clicked, it checks if the text typed in was correct, and then creates a hint saying that said team wins. Here is my code: (this is inside of a TextButton gui btw)
gui = script.Parent.Parent
button = script.Parent
function onClicked(player)
if script.Parent.Parent.box.Text == "Winner" or "WINNER" then
local hint = Instance.new("Hint", workspace)
hint.Text = player.Team.Team .. " wins!"
gui.Enabled = false
wait(5)
hint:Destroy()
end
end
script.Parent.MouseButton1Click:connect(onClicked)
Output: Players.Brad_xv.PlayerGui.Challenge2.button.Script:5: attempt to index local 'player' (a nil value)

1 comment
This is inside a script so instead of game.Players.LocalPlayer, is gui.Parent.Parent.