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

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

Asked by 4 years ago
--[ 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

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. BuDeep 214 — 4y
0
so, no it isn't. It's just messed up on here. NarwhalAndMe 141 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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

0
but its getting the player inside of the player folder, and looking at PlayerScripts. This is just getting more confusing! NarwhalAndMe 141 — 4y
0
Are you sure plr isn't a nill value? Try to print it kangerujack 20 — 4y
Ad

Answer this question