Hi peoples of the internet, after trying to make a tycoon(and failing to), i decided to do a rewrite of my system, but it wont work! No errors are produced, the lines i think are causing the problem are Line 20 and Line 53, anybody out there know how to fix this?
What is happening: I am trying to put a item into a folder in workspace, put it won't work dependency is all fine and stuff
Tycoon setup: https://gyazo.com/2d1ba2afb80da7a1a799672f62e18a96
If you need anything else, ask.
(i used a few parts of the script from a tutorial, like dependency stuff)
My script:
local tycoon = script.Parent.Parent local bought = tycoon.Bought local buyables = tycoon.Buyables local buttons = tycoon.Buttons local objects = {} local function ensureownerhit(plr) -- ignore this please end for i, v in pairs(buttons:GetChildren()) do if v then if v.Head then local objectthing = buyables:WaitForChild(v.Object.Value) if objectthing then objects[objectthing.Name] = objectthing:Clone() objectthing:Destroy() if v:FindFirstChild("Dependency") then coroutine.resume(coroutine.create(function() v.Head.CanCollide = false v.Head.Transparency = 1 v.Part.CanCollide = false v.Part.Transparency = 1 if bought:WaitForChild(v.Dependency.Value) then v.Head.CanCollide = true v.Head.Transparency = 0 v.Part.CanCollide = true v.Part.Transparency = 0 end end)) end local debounce = false v.Head.Touched:Connect(function(hit) if not debounce then debounce = true if v.Head.CanCollide then objects[v.Object.Value] = bought v:Destroy() end debounce = false end end) end end end end
You need to set the parent for objects[objectthing.Name] to the workspace or wherever you want to put it.