I need help with a script for a core game

Hey developers,

So I’m trying to make a core game. But the only problem is, I haven’t figured out how to get a meltdown working.

Because what is going to happen is there is going to be 6 lasers (2 are extra lasers) and if all the lasers are on for 7 - 10 minutes, then the core will explode and a meltdown will occur.

This is my code currently:

local on = false -- DO NOT TOUCH

local core = workspace.Core

local laser5 = core.MainLaser5
local beam1 = laser5.Extra.mid
local beam2 = laser5.Laser1.e
local beam3 = laser5.Laser2.e

local laser6 = core.MainLaser6
local beam4 = laser6.Extra.mid
local beam5 = laser6.Laser1.e
local beam6 = laser6.Laser2.e

function activation()
	workspace["Core Interaction"].Button.ClickDetector.MaxActivationDistance = 0
	on = true
	script.Parent.Music:Play()
	script.Parent.ClickDetector.MaxActivationDistance = 0
	script.Parent.Color = Color3.fromRGB(64, 221, 21)
	beam1.Transparency = 0
	beam2.Transparency = 0
	beam3.Transparency = 0
	beam4.Transparency = 0
	beam5.Transparency = 0
	beam6.Transparency = 0
	wait(18)
	workspace["Core Interaction"].Button.ClickDetector.MaxActivationDistance = 10
end

function deactivation()
	script.Parent.Shutdown:Play()
	on = false
	script.Parent.ClickDetector.MaxActivationDistance = 0
	script.Parent.Color = Color3.fromRGB(127, 0, 0)
	beam1.Transparency = 1
	beam2.Transparency = 1
	beam3.Transparency = 1
	beam4.Transparency = 1
	beam5.Transparency = 1
	beam6.Transparency = 1
end

script.Parent.ClickDetector.MouseClick:Connect(function()
	if on == false then
		activation()
		script.Parent.ClickDetector.MaxActivationDistance = 0
		wait(1)
		script.Parent.ClickDetector.MaxActivationDistance = 10
	else
		deactivation()
		script.Parent.ClickDetector.MaxActivationDistance = 0
		wait(1)
		script.Parent.ClickDetector.MaxActivationDistance = 10
	end
end)

Thank you for helping! Much appreciated :heart:

6 Likes

You do know that were supposed to help you not completely give you a working game? Never make a statement that game is gonna come out before you can complete it.

Anyways whats the issue exactly?

2 Likes

So I’m trying to make a meltdown system, but I do not know how to set it if the all the lasers are on at the same time for like 10 - 20 minutes, then the core explodes and it becomes a meltdown.

1 Like

That’s a solution to a question what is tick() You could try something like that lets say 10 minutes then tick would count 600 seconds and then you do the thing etc. Hope this helps!

2 Likes

That helped a little bit. But I’m still confused, how would I be able to make it if the value on == true for more than 10 minutes, it activates meltdown?

1 Like

when you set the value to “on” do the tick and then when the button is pressed or something check if tick > 600 ( – 10 mins) then do the explosion

2 Likes

Ok I’ll try, thank you for your help! :heart:

1 Like

I’m still quite confused. I’m sorry.

if on == true then
	local current_time = tick()
	wait(600)
	print("Meltdown")
	elseif on == false then
end

I don’t get how you would check a tick? @aabols2010

1 Like

Pretty sure they already told you how

local MDTime = 600
if on == true then
	local current_time = tick()
	wait(MDTime)
if current_time > MDTime
	print("Meltdown")
	elseif on == false then
end

why are you running a check if the script is forced to wait the required amount of time? I haven’t read the original script yet so my bad if I missed something, I’ll read it after this post

4 Likes

May sound funny i have never used tick() but i know how it functions etc.

@Kyoobuyu_Shurai did make a good example though!

1 Like

@TeamDreams123 Also I don’t know if this is known but the core games you reference don’t go off this method to check whether a meltdown should occur or not. Instead, they use a value that acts as the “Temperature” of the core. When the core exceeds a specific temperature, they will trigger the meltdown. they usually have a set increase depending on a few factors, like multiple lasers that add to the temperature more depending on how much are on. This allows you to have more control since you can set different things to happen at certain temperatures.

If you weren’t aware of this, I would personally suggest switching to this since I can turn off 1 laser in your game and the timer would technically be reset based off how you’ve described how it works. (The moment all your lasers turn on, given this current script, a meltdown is guaranteed anyway since turning off the lasers won’t stop the Wait() and you don’t check if all the lasers are still on, only if the required time has passed in which it has since you forced the script to wait it out. I assumed this is a button only you or other devs can press to test if the meltdown works but then it adds the question of why it’d need a 10 minute startup)

If you chose to go with this method then that’s all good, I just figured that the former method made more sense.

3 Likes

This is true, i made some weird core games before and these core games had temperature system, not time system

Thank you. The only issue is, the game is releasing in 6 days and it’s already been delayed twice.

I’m really not going to be able to make a temperature system in 6 days of a launch of a game. I’m a beginner scripter.

are you popular? im just asking, also can I ask for the link of your game? i want to play it

1 Like

Well default(normal) temperature can be like 70 degrees or something once you activate it it goes up by seconds etc. by 1 or more degrees and until its like 5000 degrees it can explode. That how i would go for it

6 days is more than enough to finish that! You can easily do it

You can do temperature systems like

  1. insert NumberValue named “temp” on workspace
  2. make a script that changes the number value’s value depending on laser activation ( 1 laser activate = -2 temp per sec, 2 laser activate = +2 temp per sec )
  3. make a script that when the number value’s value reaches 0 or 3000 ( any number u want ) then the freezedown or meltdown happens

that was the method i used on my core games

1 Like

No problem, I am curious as to why you would give a release date if you are uncertain of its release. I’m sure something unexpected can come up but I would only give a release date if you are absolutely sure that you can push the game out on the given date. It’s a very easy mistake to say that one thing can happen and quickly overestimate yourself on the matter, causing aforementioned delays and tight deadlines.

There are quite a few games I can call off the top of my head that get negative reception for doing this even if they show progress towards their next update / release. Stating a release date is placing that upon the trust of whatever community you have given it to and if that line is bent too much, then the actual picture becomes distorted and trust becomes scepticism. You’ll want to maintain that trust carefully as it can make or break your game’s activity. If you don’t care about activity then there’s still other factors that get affected like reputation and whatnot. It’s a thing that shouldn’t be taken lightly.

A temperature system doesn’t seem like a hard thing to implement but as you said, you’re a beginner so I wouldn’t add more pressure than what you already have, you can try change it after the release when you’ve lifted any deadlines you’ve given yourself

Anyway, I don’t think scripting support is the place to talk about all that, Is the code working as intended?

1 Like

It’s coming out soon. I’ll see what I can do.

No way

thanks for responding, also when you publish the game, plz send me the link, i rly want to play. :slight_smile: