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

why isnt it getting the player scripts attribute? (if it even should be called attribute)

--[ Variables ]--
local character = script.Parent
local plr = game.Players:GetPlayerFromCharacter(character)
local guns = plr:WaitForChild("PlayerScripts")
local random = 0

--[ Main Code ]--
if random == 0 then
	random = math.random(1,2)
	if random == 1 then
		guns.Revolver.Disabled = false
	end
	if random == 2 then
		guns.Ak47.Disabled = false
	end
end

Script says that it has an infinite yield on it, confused on what that means, can somebody help me? This is a regular script inside of the StarterCharacterScripts folder inside of the StarterPlayer folder. There are 2 scripts inside of the StarterPlayerScripts called Revolver and Ak47 that make the guns appear on the screen.

Sincerely,

Narwhal

2 comments

0

Is the character line a comment in your actual script like it is here? Also ServerScripts cannot access this folder, you will have to use a local script.

0

so, no it isn't. It's just messed up on here.

1 answer

An infinite yield means that "PlayerScripts" never appears inside of the character.

2 comments

0

but its getting the player inside of the player folder, and looking at PlayerScripts. This is just getting more confusing!

0

Are you sure plr isn't a nill value? Try to print it

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