Boost Spawn Script
local Rep = game:GetService("ReplicatedStorage")
local Boosts = Rep:WaitForChild("Boosts")
local BoostObj = {}
local BoostSpawn = {}
for i,v in pairs(workspace.BoostSpawns:GetChildren()) do
table.insert(BoostSpawn,v)
end
for i,v in pairs(Boosts:GetChildren()) do
table.insert(BoostObj,v)
end
local rand = BoostObj[math.random(1,#BoostObj)]
local Clone = rand:Clone()
Clone.Parent = workspace.Boosts
local RandSpawn = BoostSpawn[math.random(1,#BoostSpawn)]
repeat
wait()
RandSpawn = nil
RandSpawn = BoostSpawn[math.random(1,#BoostSpawn)]
until RandSpawn.Spawned.Value == false
RandSpawn.Spawned.Value = true
Clone:SetPrimaryPartCFrame(RandSpawn.Position)
Clone.Spawn.Value = workspace.BoostSpawns[RandSpawn.Name]
while wait(5) do
local rand = BoostObj[math.random(1,#BoostObj)]
local Clone = rand:Clone()
Clone.Parent = workspace.Boosts
local RandSpawn = BoostSpawn[math.random(1,#BoostSpawn)]
repeat
wait()
RandSpawn = nil
RandSpawn = BoostSpawn[math.random(1,#BoostSpawn)]
until RandSpawn.Spawned.Value == false
RandSpawn.Spawned.Value = true
Clone:SetPrimaryPartCFrame(RandSpawn.Position)
Clone.Spawn.Value = workspace.BoostSpawns[RandSpawn.Name]
end
Boost's Boost script:
local Hitbox = script.Parent.Hitbox
local Amnt = script.Parent.Amount
function boost(player,Amnt)
local Info = player.Info
local Click = Info.ClickValue
Click.Value = (Click.Value)*Amnt
wait(15)
Click.Value = (Click.Value)/Amnt
local Spawn = script.Parent.Spawn.Value
Spawn.Spawned.Value = false
script.Parent:Destroy()
end
Hitbox.Touched:Connect(function(hit)
if hit.Parent then
if hit.Parent:FindFirstChild("Humanoid") then
if game.Players:GetPlayerFromCharacter(hit.Parent) then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
v:Destroy()
end
end
boost(Player,Amnt.Value)
end
elseif hit.Parent.Parent then
if hit.Parent.Parent:FindFirstChild("Humanoid") then
if game.Players:GetPlayerFromCharacter(hit.Parent.Parent) then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent.Parent)
boost(Player,Amnt.Value)
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("BasePart") then
v:Destroy()
end
end
end
end
end
end
end)
Error:
Workspace.Boosts.Boost.Script:11: attempt to index local 'Spawn' (a nil value)
It wont spawn the boost because of the script inside of the boost erroring

2 comments
Do not use Lighting as storage.
Ok I changed it to Replicated Storage but I still have the same error