#tycoon help please
103 messages · Page 1 of 1 (latest)
Jeez man... Why dont you just hire us for free to make a game for you?
tempting offer, however i’d rather learn how to do it myself with the advice of those willing to help
👍🏾👍🏾
once i get the hang of it i’ll make myself scarce
Did you ever heard of sarcasm?
i don’t think i have, is that some type of new addition to roblox lua ??
first i find out about coroutines now this🤦🏾♀️
that was also sarcasm😵
but back on topic would u happen to have an answer
yes i know
What is the script tho
it’s in the forum description , i uploaded an image
Based on the prev messages, I was sure I was talking with an idiot, nothing personal
i see nothing bruh
here it is again
haha no worries you good
Send it normally
thats what i was about to say
Sup wassup again
I don’t want to see your screen glare all over the script mate
bruh i can’t get discord on this intel celeron ass pc😔
i can try but give me a few minutes
i’m surprised roblox studio works on this
As you can imagine, he doest have discord on his laptop
almost any modern day laptop should be able to run discord
Guys, lets all make a game for this guy so he doesnt have to create a post every hour
and I see windows 10, windows 10 machines should easily be able to do so
does bought 6 years ago count as modern day
you do models. I'll do the scripts 🤷♂️
done within a hour
yes
bet
ykw
I had a low end laptop that was also made roughly 6 years ago, it could easily run discord and it only had 4 gbs of ram
since y’all planning to do all this
I pentium I think
the actual code is in workspace>tycoons>tycoon>scripts>core
pentiums way better than celeron
i wish my mess was pentium
I'm glad I don't need a pentium anymore
line 201
errors = good script
multiple times but idk what a stack end is
thhat wasn’t in the roblox studio tutorials i’ve seen
they always ignore it
what the fuck
a stack end means the script will stop working
once a script comes across a line while running it can't execute then it will stack end, meaning it will stop running the script and return an error
an example of this:
print("Hello world")
syntax error which will clearly stack end the script
print("Hello world")
it will print once, then stack end on line 2
ohh wait so
11:51:00.264 Stack Begin - Studio
11:51:00.264 Script 'Workspace.Tycoons.Tycoon.Scripts.Core', Line 169 - Studio - Core:169
11:51:00.265 Stack End - Studio
this core script stopped working at like 169?
man wtf
wait i know why
some of the object values i added disappear when i test the game
The Issue is located in the "playSound" function remove the "wait(1)" and the issue will be fixed
This is caused because the sound finished playing before the Ended:Wait() call
just noticed that in a test as well, quite sure those 2 models get destroyed by a script
So it is in a infinite loop of waiting
a different issue is that the stack ends on WFC due to an instance not existing and there only being 1 param
@nova kindle
I've just read a tad more script and I notice that the script removes those items from existence
okay i’ll try this out, i opened edge to post that stack end block of code and now pc is unresponsive so give me a little bit
browser version of discord + roblox studio was too much for it 😔
I tested it and it was the issue with the cash collector
tell me if it works for you
is there just multiple issues with the script that never got picked out😭
** You are now Level 5! **
some glitches only occur when certain criteria are met
like this was caused by both a sound being shorter than a wait (so it ended before the script started waiting for it to end
oh
I guess discord doesn't like that plugin
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 audio = tycoon:FindFirstChild("Audio")
local debounce = false
local objects = {}
local tweenService = game:GetService("TweenService")
local random = Random.new()
local BUILDING_ANIMATION_POSITION_OFFSET_AMOUNT = 2
local BUILDING_ANIMATION_PART_DELAY = .03
function hasProperty(instance,property)
assert(typeof(instance) == "Instance")
assert(typeof(property) == "string")
local hasProperty = false
pcall(function()
local v = instance[property]
hasProperty = true -- This line only runs if the previous line didn't error
end)
return hasProperty
end
function instanceListToPropertyDict(instances, propertyList)
assert(typeof(instances) == "table")
assert(typeof(propertyList) == "table")
-- [[given a list of instances and a list of properties, construct a disctionary like so:
-- dict = {
-- [instance1] = {property1 = instance1.property1, property2 = instance1.property2, ...},
-- [instance2] = {property1 = instance2.property1, property2 = instance2.property2, ...},
-- ...
--}]]
local dict = {}
for _, instance in ipairs(instances) do
local dictEntry = {}
for _, property in pairs(propertyList) do
assert(hasProperty(instance,property), string.format(
[[Instance '%s' (a %s) doesn't have property '%s'.]],
tostring(instance), instance.ClassName, property)
)
dictEntry[property] = instance[property]
end
dict[instance] = dictEntry
end
return dict
end
function getDescendantsWhichAre(ancestor,className)
assert(typeof(ancestor) == "Instance")
assert(typeof(className) == "string")
--[[returns all descendants of ancestor which are of class className or a class that inherits from className]]
local descendants = {}
for _, descendant in pairs(ancestor:GetDescendants()) do
if descendant:IsA(className) then
table.insert(descendants, descendant)
end
end
return descendants
end
function animateBuildingIn(buildingModel,tweenInfo)
assert(typeof(buildingModel) == "Instance" and buildingModel.ClassName == "Model", string.format(
"Invalid argument #1 to 'animateBuildingIn' (Model expected, got %s)",
typeof(buildingModel) == "Instance" and buildingModel.ClassName or typeof(buildingModel)
))
assert(typeof(tweenInfo) == "TweenInfo",string.format(
"Invalid argument #1 to 'animateBuildingIn' (TweenInfo expected, got %s)",
typeof(tweenInfo)
))
--Collect BaseParts and original properties
local parts = getDescendantsWhichAre(buildingModel, "BasePart")
local originalProperties = instanceListToPropertyDict(parts, {"Transparency", "CFrame", "Color", "Size"})
--make parts invisible and randomly move them
for _, part in pairs(parts) do
part.Transparency = 1
part.Color = Color3.fromRGB(255,255,255)
part.Size = Vector3.new()
local positionOffset = Vector3.new(random:NextNumber(-1,1),random:NextNumber(-.25,1.75),random:NextNumber(-1,1)) * BUILDING_ANIMATION_POSITION_OFFSET_AMOUNT
local rotationOffset = CFrame.Angles(random:NextNumber(-math.pi, math.pi),random:NextNumber(-math.pi, math.pi),random:NextNumber(-math.pi, math.pi))
part.CFrame *= CFrame.new(positionOffset) * rotationOffset
end
--tween them back to their original state, one at a time```
local lastTween --Return this so the caller can do animateBuilding(...):Wait() to wait for the animation to complete
for _, part in pairs(parts) do
local tween = tweenService:Create(part,tweenInfo,originalProperties[part])
lastTween = tween
tween.Completed:Connect(function(playbackState)
--sometimes tweens stop before reaching their goal properly.
-- make sure each Part is *exactly* how it was before.
part.Transparency = originalProperties[part].Transparency
part.CFrame = originalProperties[part].CFrame
end)
tween:Play()
wait(BUILDING_ANIMATION_PART_DELAY)
end
return lastTween.Completed
end
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)
function playSound(object,soundID)
if object:FindFirstChild("Sound") then
return
else
local sound = Instance.new("Sound",object)
sound.SoundId = soundID
sound:Play()
sound.Ended:Wait()
sound:Destroy()
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:FindFirstChild(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
playSound(v,audio.buttonSound.SoundId)
v:Destroy()
end
end
end
end
end)
end
tycoon.PurchasedItems.ChildAdded:Connect(function(add)
animateBuildingIn(purchasedItems:FindFirstChild(v.Object.Value),TweenInfo.new(1,Enum.EasingStyle.Elastic, Enum.EasingDirection.Out)):Wait()
end)
end)
end
end
mainItems.CashCollector.Button.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player ~= nil then```
if values.OwnerValue.Value == player then
if player.Character.Humanoid.Health > 0 then
if debounce == false then
debounce = true
mainItems.CashCollector.Button.BrickColor = BrickColor.new("Really red")
player.leaderstats.Cash.Value += values.MoneyValue.Value
values.MoneyValue.Value = 0
playSound(mainItems.CashCollector,audio.moneySound.SoundId)
task.wait(1) --cooldown before cash can be collected once again
mainItems.CashCollector.Button.BrickColor = BrickColor.new("Lime green")
debounce = false
end
end
end
end
end)
--purchasedItems.KillDoor.Build.killDoorHitBox.Touched:Connect(function(hit)
-- print('bruh')
-- local humanoid = hit.Parent:FindFirstChild("Humanoid")
-- if humanoid then
-- print(humanoid.Name)
-- end
--end)```
there's your fixed script @nova kindle
took me a tad because I had some debugging prints as I wanted to make sure some other parts of the functions where working
I ain't reading allat
i def will
i preesh this heavy🙏🏾🙏🏾i’ll lyk how it works once this computer thaws
all this changes over your old script is remove the wait in the PlaySound function, then change out the error line's WFC for a FFC, and add a small note around the end
Cmon guys... Just let the guy do his own game, are you really gonna make the entire game wtf?
we agreed that I get 140% of the revenue
Hahaha
so the cash works now but i think the wfc might’ve been necessary because now the next buyable item in the tycoon isn’t popping up
the killdoor
Let me smoke 1 more cig and I’ll do some testing
