Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Two Questions, about GUI, how do I do this?

Asked by 7 years ago

how do I assign a variable that refers to the player's character that is using a gui and works in-game. How do i make it so the player can type numbers in a gui and that number will be a value in a certain datatype? Thank you.

1 answer

Log in to vote
0
Answered by
crywink 419 Moderation Voter
7 years ago

Okay, I don't know what a datatype is, but I can surely tell you how to assign a variable to your player.

What your looking for is a connection, they are very simple. Basically, you are going to use PlayerAdded so that it searches for every player that has joined the game.

Here is the code you would use...

game.Players.PlayerAdded:connect (function(plr)
 -- Your code here
end)

How to use:

1. Where you see (plr) that is a bit like the variable. You will use it to define the connection and in your case, your player. You can change it to whatever you would like.

2. Your code should go inside of the connection

NOTE: IF YOU ARE USING A LOCALSCRIPT, JUST USE LOCALPLAYER NOTE: THIS IS FOR THE LOCALPLAYER, NOT FOR OTHERS

0
Yeah like you started saying at the bottom, there's normally no need for playeradded when working with guis, because you can just use the local player. Perci1 4988 — 7y
0
local player doesn't work in game though SwordsDestinyGames -11 — 7y
0
LocalPlayer does work in-game, I don't know what you are talking about. If you are using a Server-Script, LocalPlayer will NOT work. But if you are using a LocalScript, it will. crywink 419 — 7y
Ad

Answer this question