I want to make something like the pentathlon from Squid Game, but I’m trying to figure out how I can make my code work for everyone. I don’t know how to turn my code into a local script, I’ve tried for a few hours but I couldn’t get anything to work. Could anyone tell me what I could do?
Click on the script,
Find RunContext
Set it to client
Now it runs locally
If i’m wrong, im sorry, to make me understand, can i know what will the script should actually do?
It makes the UI appear, with the minigame.
Also, I tried what you said and it showed up the UI, but the game didn’t actually work.
Instead of placing the GUI right under the object try placing it on starter gui and turn of the visibility of frames / disable the gui. I suppose you already detect when a character hits the part, in this case get the player using Players:GetPlayerFromCharacter()
and fire a remote event. This remote event can be picked up by a local script inside your GUI.
Ill try that, but would it be like possible to disable there speed?
Yes, you can either do that on the server or the client. Just set the Humanoids WalkSpeed property to 0
Okay, I’ll tell you if I encounter any problems when I make the script.
Quick question, my game is trying to make the minigame repeat (Since it’s sorta like a game where you can host your own Squid Game), but in this case, the minigame will destroy itself upon completion. I don’t know if this method will account for that.
success:Play()
wait(2)
ui:Destroy()
Instead of destroying the UI make it invisible or disabled instead.
Yes I know, but what if the player steps into it again? I want to make the minigame basically repeat if you touch it again.
This won’t be a problem with the solution I provided above, when receiving the remote event you can make the UI visible which will function everytime someone steps on the block.
I’ll try it, and I’ll reply later if anything goes wrong
I got the local script to work, it opens perfectly. But I’m trying to make it close, which it will not work. I’m trying to revert the enabled to false but it didn’t close.
print("success")
success:Play()
wait(2)
screengui.Enabled = false
Should I fire a remote event instead to close it?
Are you correctly defining the screengui? Also I recommend adding debounce to check if the minigame is already playing. Add local debounce = false
at the very start, check if it is false whenever the remote is received, then set it true. After the entire function is over wait a few seconds of your choice and make debounce false again.
I think so,
this is how I’m defining it.
local screengui = game.StarterGui["ddajaki "]
is this the correct method?
No, that will only make the gui inside startergui invisible. Every gui is parented inside “PlayerGui” which is inside the player. You should make it invisible through the client (perhaps script.Parent equals to the gui), not the server.
I’ll try it, I’ll tell you how it goes
You can make a table with certain players to whom the given game will be displayed, and use the function show game (If you have speculators who don’t need to be shown the game)
local playingPlayers = {}
for i,v in pairs(playingPlayers) do
local Player = v
-- here make gui moved to player
end
There is another way, use RemoteEvent:FireAllClients()
but if you have spectators in game, they will also be shown the game