local give = eco:Clone()
give.Parent = player.Backpack -- here is error: Workspace.SCI.Screen.SurfaceGui.Script:53: attempt to index nil with 'Backpack'.
Anyone know how to fix - its a normal script within a surfacegui in workspace.
Full Script
local startbtn = script.Parent.StartP.ImageButton
local Players = game:GetService("Players")
local part = workspace.SCI.playername
local ecobtn = script.Parent.Select.ecobtn
local ecosbtn = script.Parent.Select.ecosbtn
local ecopbtn = script.Parent.Select.ecopbtn
local business = script.Parent.Select.Business
local eco = game.ServerStorage.Tickets:WaitForChild("Eco Boarding Pass")
local ecos = game.ServerStorage.Tickets["Strech Boarding Pass"]
local ecop = game.ServerStorage.Tickets["Premium Eco Boarding Pass"]
local bus = game.ServerStorage.Tickets["Business Boarding Pass"]
---
part.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
_G.name = player.Name
end
end)
local function start() -- bug here
script.Parent.Parent.Parent.Collide.CanCollide = true
script.Parent.StartP.Visible = false
script.Parent.loadingscreen.Visible = true
wait(3)
script.Parent.loadingscreen.Visible = false
script.Parent.Select.TextLabel.Text = _G.name
script.Parent.Select.Visible = true
script.Parent.Select.ecobtn.MouseButton1Click:Connect(function(player)
local ecoremotevent = game.ReplicatedStorage.SCIEvents.EconomyClickEvent
script.Parent.Select.Visible = false
script.Parent.Printing.Visible = true
local give = eco:Clone()
give.Parent = player.Backpack -- here is error: Workspace.SCI.Screen.SurfaceGui.Script:53: attempt to index nil with 'Backpack'.
wait(4)
script.Parent.Parent.Parent.Collide.CanCollide = false
script.Parent.Printing.Visible = false
local endscreen = script.Parent.endscreen
endscreen.Visible = true
wait(5)
endscreen.Visible = false
script.Parent.StartP.Visible = true
end)
end
---
startbtn.MouseButton1Down:Connect(start)