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

whats wrong with this script ?

output:20:08:16.118 - Workspace.Script:24: attempt to index a nil value 20:08:16.118 - Stack Begin 20:08:16.119 - Script 'Workspace.Script', Line 24 20:08:16.120 - Stack End

function setMessageVisibility(objects, visible)
    for _, object in pairs(objects) do
        object.Visible = visible
    end
end

game.Players.PlayerAdded:connect(function(player)	
local pack = Instance.new("Model",game.Lighting)

local holder = game.Lighting.holder
holder:clone().Parent = pack

local clothes = game.Lighting.clothes
clothes:clone().Parent = pack

local faces = game.Lighting.faces
faces:clone().Parent = pack

local inventory = game.Lighting.inventory
inventory:clone().Parent = pack
pack.Name = player.Name.."sPack"
script.Parent.check.Value = 0
if player.Name == "Player" then
game.ServerStorage:findFirstChild(game.ServerStorage.GM, true):GetChildren():Clone().Parent = game.Lighting.player.Name.."sPack"..inventory
	end
end)

1 comment

0

Your question is too vague; What is wrong? Was there any Output? Is this the whole script? What isn't working about it? Because, looking at it, this IS NOT the entire script, but, however, I am seeing ALLOT of errors in this small chunk of code.

1 answer

✓ Accepted answer

Well to start, your first argument for FindFirstChild is incorrect. You already told it to look for this in ServerStorage so telling it again actually is telling it to find game.ServerStorage.game.ServerStorage (which doesn't exist) Also, try simplifying this script. EXAMPLE

if player.Name == "Player" then
Argue = game.ServerStorage:FindFirstChild("GM") --I have no clue what the "true" is for, please let me know if I need it.
Children = Argue:GetChildren()
Thing = Children:Clone()
Thing.Parent = game.Lighting.player.Name --IDK what you did, but including [.."sPack"..] is also going to break this.

A lot of things in your script are inefficient and incorrect. My answer probably won't fix the script, but it will get you closer. When you finish fixing what I have given you, please edit your question for further review.

If I helped, please accept my answer

If there are any bugs, let me know and I will correct them if I can

THANKS!

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