You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
This script is supposed to give player swords, though the script this happens is cloned from “ServerStorage”, I did this so my game could have both random maps and gamemodes, TempContestants is a folder kept on the map models, and it has “Object Values” of Players currently playing. -
What is the issue? Include screenshots / videos if possible!
Whenever the script for the sword gamemode activates, it for some reason it does not give the player swords, and giving me the error "Attempt to index nil with “TempContestants”, the game does manage to access the map and the gameinfo folder.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve already tried looking for solutions on the developer hub, and stuff like adding “Wait()” in case the script went off before it was filled in.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Map = game.Workspace.LoadedMap:GetChildren()
for i,v in pairs (Map.GameInfo.TempContestants:GetChildren()) do
if v.Value then
local player = v.Value
if player and player.Character then
local humanoid = player.Character:FindFirstChild("Humanoid")
if humanoid then
local sword = game.ServerStorage.Tools.Swordd:Clone()
sword.Parent = player.Backpack
end
end
end
end