I want it to get the character from the player when the button is clicked, here's my script.

Button = script.Parent
Button.MouseButton1Up:Connect(function(Player)
	local char = Player.Character
	if char then
		if Player.leaderstats.Doges.Value >= 100 then
			Player.leaderstats.Doges.Value = Player.leaderstats.Doges.Value - 100
			char.Head.BillboardGui.TextLabel.BackgroundTransparency = 0
			char.Head.BillboardGui.TextLabel.TextTransparency = 0
			char.Head.BillboardGui.TextLabel.Text = "Noob"
		else
			Button.Sound.Playing = true
		end
	end
end)

4 comments

0

What exactly is the problem?

0

This is the error: Players.kennyb1023.PlayerGui.ScreenGui.Shop.ScrollingFrame.TextButton.Script:3: attempt to index number with 'Character'

0

if the Button variable (script.Parent) is a GuiObject, then the event MouseButton1Up returns the X, Y positions of where MouseButton1 was let go. what you're actually doing is trying to do X.Character, but X is a number, not the player who clicked the button. Hence you get the error "index number with 'Character'

0

Thanks