How can i do this in my game?

I wanted to make a game like the game “Hex-A-Gone” in FallGuys but after a round the part regenerate way to slow so i wanted to ask here if there is anyway of coding that they regenerate them selfs instantly after a game is over. I also have a BoolValue for another script to see if its in a round or not. I’m not very experienced with coding so i don’t know stuff that well.

Do the tiles respawn after an amount of time? Is that what you mean by it being too slow?

they do respawn after the ime i set but they should respawn after a round has ended but instantly.

Could I see their script?

Ignore this (blame the word limit)

sure:

local platform = script.Parent

local isTouched = false

local function fade()
	if not isTouched then
		isTouched = true
		for count = 1, 3 do
			platform.Transparency = count / 3
			task.wait(0.1)
		end
		platform.CanCollide = false
		task.wait(140)
		platform.CanCollide = true
		platform.Transparency = 0
		isTouched = false
	end
end

platform.Touched:Connect(fade)

You’re probably better off posting this in #help-and-feedback:scripting-support

yea im sorry im in quite a hurry rn and didnt know where i should post it but thanks for your friendly reminder!

I recommend using something like collection service to provide these tiles with their functionality or you could just have a main script which loop through the child tiles and provides them with their functionality. Having this many scripts scattered throughout every tile will make it really frustrating for you as a developer to edit elements of the script, especially if you have a large amount of them.

As of the actual issue, I would store the map in ServerStorage and when a round starts, I’d clone it to workspace. That way when the round ends you can easily delete the used version and then replace it with an untouched version.

may you give an example of a code?

(dont mind my short words!)

which part? the first or the second paragraph? or both?

I don’t know what you mean by it but i guess both because it may help me out more!

is there still an answer i may egt since ive been waiting for 22 minutes now and idk what your writing all but i guess its much text!

Alright awesome, glad you’re eager to learn! :smile:

Loading and destroying the map
So to start off I would recommend storing your map as a model or folder in a folder called ‘Maps’ that sits in ServerStorage. Then with your main script game loop, (I’m assuming you have one of these once again - let me know if not!) whenever the round starts insert:

local ServerStorage = game:GetService("ServerStorage")

local chosenMap = ServerStorage.Maps:GetChildren()[math.random(1, #ServerStorage.Maps:GetChildren())]
local mapClone = chosenMap:Clone()
mapClone.Parent = workspace

Now you should have the map model appear in workspace when you press the run button (if you want an explanation of how this works then feel free to ask :smile: )

When you want to end the map then just write

mapClone:Destroy()

and that should be it for loading and destroying the map! Keep in mind that this system will also allow you to implement multiple maps into your game as it randomly selects a map from the ‘Maps’ folder in ServerStorage.

Functionality
So currently I believe you’re storing this script in every single platform right? Instead of doing that, perhaps apply the functionality through a for loop or use CollectionService.

To load functionality using a for loop simply create a folder in the map that contains all of the platforms in the map and name it ‘Platforms’

Then insert this below the map loading section and above the destroy section:

for _, platform in pairs(mapClone.Platforms:GetChildren()) do
	platform.Touched:Once(function()
		for count = 1, 3 do
			platform.Transparency = count / 3
			task.wait(0.1)
		end
		platform.CanCollide = false
	end)
end

Another way to make this work involves CollectionService which you can avoid using in this scenario although I would recommend learning how to use it because it’s extremely useful in many situations.

Here’s the documentation if you would like to learn about it:

Hope this helps! :smile: Let me know if you have any questions

sorry I took so long haha, I appreciate you waiting! :smile:

I Appreciate you helping me. :grinning: otherwise i would be lost! :joy:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.