Комментарии:
Please make sure you do not put spaces in the names of your items inside your Purchased Items folder.
Main Script:
local buttons = tycoon:FindFirstChild("Buttons")
local purchasedItems = tycoon:FindFirstChild("PurchasedItems")
local objects = {}
if buttons then
for i, v in pairs(buttons:GetChildren()) do
spawn(function()
if v:FindFirstChild("Button") then
local newObject = purchasedItems:FindFirstChild(v.Object.Value)
if newObject ~= nil then
objects[newObject.Name] = newObject:Clone()
newObject:Destroy()
else
v:Destroy()
end
if v:FindFirstChild("Dependency") then
v.Button.Transparency = 1
v.Button.CanCollide = false
v.Button.BillboardGui.Enabled = false
coroutine.resume(coroutine.create(function()
if purchasedItems:WaitForChild(v.Dependency.Value) then
v.Button.Transparency = 0
v.Button.CanCollide = true
v.Button.BillboardGui.Enabled = true
end
end))
end
v.Button.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if values.OwnerValue.Value == player then
if v.Button.CanCollide == true then
if player:FindFirstChild("leaderstats").Cash.Value >= v.Price.Value then
player.leaderstats.Cash.Value -= v.Price.Value
objects[v.Object.Value].Parent = purchasedItems
v:Destroy()
end
end
end
end
end)
end
end)
end
end
Script inside of buttons:
local ownerValue = script.Parent.Parent.Parent.Parent.Values.OwnerValue
ownerValue.Changed:Connect(function()
if ownerValue.Value then
local player = ownerValue.Value
while wait(0.1) do
if player:FindFirstChild("leaderstats").Cash.Value >= script.Parent.Parent.Price.Value then
script.Parent.BrickColor = BrickColor.new("Lime green")
else
script.Parent.BrickColor = BrickColor.new("Really red")
end
end
end
end)
i got an error: Button is not a valid member of Model "DropperButton" - Server - Core:37
then the buttons just desapeared...
Hello, I'm having a small hiccup in my code and I would like to know if there is anybody who could help me! It would mean a lot, thank you.
My main problem I'm having is: the first dropper button appears, but when stepping upon it, the dropper also appears. But then, the colorizer button doesn't show up, and I don't think the colorizer would even show up in the workspace.
If anyone needs my code pasted or anything, I will gladly paste it here.
For me i have an error Button is not a valid member of Model "DropperButton" - Server - Core:50 in the second button, because of the error the button doesnt show up
ОтветитьHaving trouble again, when I step on the first button, it works but the second one doesn’t appear.
Ответитьwhy is it when i start the game the colorizer button shows before i touched the dropper button?
ОтветитьDosent duplicate the button dosent change color 😢
ОтветитьI don’t know what I did wrong but every time I touch the Dropper 1 button it says that Workspace.Tycoons.Tycoon.Script.core:55: attempt to index nil with ‘Cash’ can someone help me please.
ОтветитьIm not sure where i went wrong but the second button doesnt turn green even when the CashValue inside my tycoon reaches above the amount i set it to
Ответитьcan you have 2 different parts on a button? a base and the button
ОтветитьIs The part where u need to make the material and colourchanger nececerrely for this Episode?
ОтветитьCore Script:
local tycoon = script.Parent.Parent
local mainItems = tycoon:FindFirstChild("MainItems")
local values = tycoon:FindFirstChild("Values")
local buttons = tycoon:FindFirstChild("Buttons")
local purchasedItems = tycoon:FindFirstChild("PurchasedItems")
local objects = {}
mainItems.OwnerDoor.Door.Touched:Connect(function(hit)
if values.OwnerValue.Value == nil then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player:FindFirstChild("HasTycoon").Value == false then
values.OwnerValue.Value = player
mainItems.OwnerDoor.Title.SurfaceGui.TextLabel.Text = tostring(values.OwnerValue.Value).."'s Tycoon"
end
end
end
end)
if buttons then
for i, v in pairs(buttons:GetChildren()) do
spawn(function()
if v:FindFirstChild("Button") then
local newObject = purchasedItems:FindFirstChild(v.Object.Value)
if newObject ~= nil then
objects[newObject.Name] = newObject:Clone()
newObject:Destroy()
else
v:Destroy()
end
if v:FindFirstChild("Dependency") then
v.Button.Transparency = 1
v.Button.CanCollide = false
v.Button.BillboardGui.Enabled = false
coroutine.resume(coroutine.create(function()
if purchasedItems:WaitForChild(v.Dependency.Value) then
v.Button.Transparency = 0
v.Button.CanCollide = true
v.Button.BillboardGui.Enabled = true
end
end))
end
v.Button.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if values.OwnerValue.Value == player then
if v.Button.CanCollide == true then
if player:FindFirstChild("leaderstats").Cash.Value >= v.Price.Value then
player.leaderstats.Cash.Value -= v.Price.Value
objects[v.Object.Value].Parent = purchasedItems
v:Destroy()
end
end
end
end
end)
end
end)
end
end
Okay, so basically I found out where my error was coming from. It was after we checked to see if newObject was nil or not (when we destroy v after the else), and I'm not too sure why its throwing me this error.
ОтветитьInfinite yield possible on 'Workspace.Tycoons.Tycoon.PurchasedItems:WaitForChild("Dropper")'
????
Please help me, he writes an error - Workspace.Tycoons.Tycoon.Scripts.Core:29: attempt to index nil with 'FindFirstChild'
Ответитьi get an error infinite yield possible for dropper?
Ответитьhey i have a problem with my buttons the colorizer button dosent dissapear and it dosent work when i try to buy it even if i have the right amount of money can you help me ?
Ответитьi get the error message "Object is not a valid member of Model "DropperButton" - Server - Core:181" and i did everything in the vid how can I fix it?
ОтветитьI get the error message "exception while signaling: Must be a LuaSourceContainer - Studio" after buying my first dropper and the one i cant afford isnt red its just white even tho i copied it so it'd be red
Ответитьit says "Cash is not a valid member of Folder "Players.Ninjaboygg1.leaderstats"
how do i fix?
Hey there! Dont know if im a bit late, but when making a new button it works perfectly fine, yet when it gets touched once, it removes the cash, and if you like walk over it it detects multiple touches, so it takes the price away from you multiple times. the cooldown (while wait do) doesnt help at all in this case.
ОтветитьWhenever you step on button for too long, (or walk on it) since the button destroys after it takes away the cash, it takes away more money then always. It quickly runs out. Any fixes? This affects the game so much as the player will spend more money unknowingly.
ОтветитьThere is an error that i tried to fix but i couldnt . The error in the output says : Button is not a valid member of Model "ColorizerButton"
ОтветитьThe tutorial was great but I have some issues :P
It said : Infinite yield possible on 'Workspace.Tycoons.Tycoon.PurchasedItems:WaitForChild("Dropper")'
Which I don't understand what it means
here's the script :
local tycoon = script.Parent.Parent
local mainItems = tycoon:WaitForChild("MainItems")
local values = tycoon:WaitForChild("Values")
local buttons = tycoon:FindFirstChild("Buttons")
local purchasedItems = tycoon:FindFirstChild("PurchasedItems")
local objects = {}
if buttons then
for i, v in pairs(buttons:GetChildren()) do
spawn(function()
if v:FindFirstChild("Button") then
local newObject = purchasedItems:FindFirstChild(v.Object.Value)
if newObject ~= nil then
objects[newObject.Name] = newObject:Clone()
newObject:Destroy()
else
v:Destroy()
end
if v:FindFirstChild("Dependency") then
v.Button.Transparency = 1
v.Button.CanCollide = false
v.Button.BillboardGui.Enabled = false
coroutine.resume(coroutine.create(function()
if purchasedItems:WaitForChild(v.Dependency.Value) then
v.Button.Transparency = 0
v.Button.CanCollide = true
v.Button.BillboardGui.Enabled = true
end
end))
end
v.Button.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if values.OwnerValue.Value == player then
if v.Button.CanCollide == true then
if player:FindFirstChild("leaderstats").Cash.Value >= v.Price.Value then
player.leaderstats.Cash.Value -= v.Price.Value
objects[v.Object.Value].Parent = purchasedItems
v:Destroy()
end
end
end
end
end)
end
end)
end
end
Please answer :D
Hey guys i made the code working for now. CODE:
if buttons then
for i, v in pairs(buttons:GetChildren())do
spawn(function()
if v:FindFirstChild("Button") then
local newObject = purchasedItems:FindFirstChild(v.Object.Value)
if newObject ~= nil then
objects[newObject.Name] = newObject:Clone()
newObject:Destroy()
else
v:Destroy()
end
if v:FindFirstChild("Dependency") then
v.Button.Transparency = 1
v.Button.CanCollide = false
coroutine.resume(coroutine.create(function()
if purchasedItems:WaitForChild(v.Dependency.Value) then
v.Button.Transparency = 0
v.Button.CanCollide = true
end
end))
end
v.Button.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if values.OwnerValue.Value == player then
if v.Button.CanCollide == true then
if player:FindFirstChild("leaderstats").Cash.Value >= v.Price.Value then
player.leaderstats.Cash.Value -= v.Price.Value
objects[v.Object.Value].Parent = purchasedItems
v:Destroy()
end
end
end
end
end)
end
end)
end
end
Thx for the nice video but😅
I have problem with my drppers they didn't drop the paert anymore
i dont have the drops leaderstats?
Ответитьdude I literarly tried everything. I dont know what is wrong . I copied the exact same script you put in the comments. I did everything as you said and it still doesn't work. when touch the first button it does absolutely nothing . this is my script it's literarly THE SAME . I spent 2 days trying to figure it out...and nothing. values right literarly everything right
local buttons = tycoon:FindFirstChild("Buttons")
local purchasedItems = tycoon:FindFirstChild("PurchasedItems")
local objects = {}
if buttons then
for i, v in pairs(buttons:GetChildren()) do
spawn(function()
if v:FindFirstChild("Button") then
local newObject = purchasedItems:FindFirstChild(v.Object.Value)
if newObject ~= nil then
objects[newObject.Name] = newObject:Clone()
newObject:Destroy()
else
v:Destroy()
end
if v:FindFirstChild("Dependency") then
v.Button.Transparency = 1
v.Button.CanCollide = false
v.Button.BillboardGui.Enabled = false
coroutine.resume(coroutine.create(function()
if purchasedItems:WaitForChild(v.Dependency.Value) then
v.Button.Transparency = 0
v.Button.CanCollide = true
v.Button.BillboardGui.Enabled = true
end
end))
end
v.Button.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if values.OwnerValue.Value == player then
if v.Button.CanCollide == true then
if player:FindFirstChild("leaderstats").Cash.Value >= v.Price.Value then
player.leaderstats.Cash.Value -= v.Price.Value
objects[v.Object.Value].Parent = purchasedItems
v:Destroy()
end
end
end
end
end)
end
end)
end
end
every time i touch the first button it says CanColide is not a valid member of Part "Workspace.Tycoons.Tycoon.Buttons.DropperButton.Button" - Server - Core:54
ОтветитьWhen I made it, the door stopped working
Ответитьwhy button not invis
ОтветитьMy colorizer is still there
Ответитьwhenever i have a second button, even when it has a different name than the first one, when i try to playtest it it says "Button is not a valid member of Model "(button name)"" and when i rename the Button"" part in the second button, it completely breaks
ОтветитьPls core script
Ответитьi get this error "Workspace.Tycoons.Tycoon.Scripts.Core:31: attempt to index nil with 'Colorizer' - Server - Core:31" and i did the exact same things as you and i wrote the code 2 times and still nothing
ОтветитьTHE CODE DOES NOT WORK
Ответить" Cash is not a valid member of Folder "Players.Pr0x_Z.leaderstats""
ОтветитьInfinite yield possible on 'Workspace.Tycoons.Tycoon.PurchasedItems:WaitForChild("Dropper")
Ответитьthis is sad now my owner door doesn't work
Ответитьthe part where it says: if newObject ~# nil then. this part ~# it gets underlined
Ответитьi did the script twice, and it just brakes, the colorizer doesnt work, owner door doesnt work, buttons doesnt work, its just all broken, but it worked just fine before i started to edit the script for this episode, and its just sad, i dont know what to do anymore.
Ответитьis it okay if i only put dropper buttons? because the colorizer button doesnt work.
ОтветитьI did all step by step but my first button doesnt working what can ı do please help @Rustysillyband
Ответить