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

How can I store a players variable?

I have a server script in a gui and I need to find a way to get the players variable, I tried using remote events but it didn't work. I need to store the players variable



while true do
		
	
		
			
		
	wait(1)
		
	script.Parent.Text = "Pick a map"
			
		
			
		
			
				
			if plr.Map.Value == 1 then -- I need the players variable to do this
				
			
				if game.Workspace.Wave.Value == 1 then
				-- the rest of my code this is a snipet to show u
-- I know there isn't any ends here

1 answer

✓ Accepted answer

Find out where the script is located in the player and trace it to the player.

Example:

-- Script -> Frame -> ScreenGui -> PlayerGui -> Player
local player = script.Parent.Parent.Parent.Parent

The player will always load in before the script in the gui because the ScreenGui needs a parent which is PlayerGui and PlayerGui needs a parent which is the player.

2 comments

0

Thx I had been struggling on it for ages

0

np!

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