Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Points exchange system not working?

I have this small casino group along with a casino I have recently made a Player Rewards program but I need the Players to be able to exchange their points for Credits below you will see my code. Warning I am not trying to get the local player! I am trying to make it where when you type into the textbox which is defined as User and then click on Button it does the function, it is a surfacegui! I use adornee so that it moves to workspace and makes the textbox works!

Button = script.Parent
User = script.Parent.Parent.Username.Text
player = game.Players.User

Button.MouseButton1Down:connect(function()
	game.Player.leaderstats.Points = game.Player.leaderstats.Points - 100
	wait(0.1)
	game.Player.leaderstats.Credits = game.Player.leaderstats.Credits + 100
	wait(0.1)
	game.Player.PlayerGui.Warning.TextLabel.Text = "Customer Service has exchanged your Points for 100 Credits"
	wait(5)
	game.Player.PlayerGui.Warning.TextLabel.Text = ""
end)

The part that is not working is it keeps saying User is not a vaild member of Players(It does not understand I am trying to use the var above named User! I do not know how to fix I have attempted to fix it 3 times already.

2 comments

0

MouseButton1Click:connect(function()

0

Can you provide any more details, is this a local script? Where is this script located? What is the exact error? You're going to game.Players.User does not exist, or if he did how is that name sniper in your game?

1 answer

Button = script.Parent
Player = game.Players.Localplayer--LocalPlayer, instead of finding user name, you get the actual player. therefore, you don't need to find the username

Button.MouseButton1Down:connect(function()
    game.Player.leaderstats.Points = game.Player.leaderstats.Points - 100
    wait(0.1)
    game.Player.leaderstats.Credits = game.Player.leaderstats.Credits + 100
    wait(0.1)
    game.Player.PlayerGui.Warning.TextLabel.Text = "Customer Service has exchanged your Points for 100 Credits"
    wait(5)
    game.Player.PlayerGui.Warning.TextLabel.Text = ""
end)

1 comment

0

"LocalPlayer"

This discussion is preserved as it was. New answers, comments, and votes are closed.