Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to trigger a ScreenGui with this Script?

Basically, im doing a Sonic Forces in roblox, and i have been programming the double boost, it getting triggered when a part is touched, And it stops after another part is touched, however, it also haves to trigger a GUI that tells you to click it, Increasing your double boost walkspeed by +10 (Regularly its 50, if you dont do anything)

I got all that made, exept for a part, The ScreenGUI Enabling to TRUE, Which haves to be done in the Double Boost Start script. This is the script i made.

local partclicked = 0
script.Parent.Touched:connect(function(part)
	if partclicked == 0 then
	partclicked = 1
--A animation should play here, dont worry, ill make it.
    if not part.Parent then return end
    local humanoid = part.Parent:FindFirstChild("Humanoid")
    if not humanoid  then return end
	game.workspace.Boostsong.Playing = true
    humanoid.WalkSpeed = 0
--In this part of the script, The player's "DoubleBoostGUI" screengui should get activated.
wait (6)
    humanoid.WalkSpeed = game.Workspace.BoostSpeed.Value
game.Workspace.Boosting.Value = true
wait(3)
partclicked = 1
end
end)

So, how do i trigger the gui?

Also, this is the screengui, just if us want to know how it looks: http://prntscr.com/j7js9i

7 comments

0

Try cloning the gui into PlayerGui.

0

The GUI is on The StarterGUI, So it gets cloned to playerGUI.

0

If the game is filtering enabled, it'll be much more difficult to get the server to enable the gui. What I would do is make the gui already enabled then clone the gui into the player when they touch the part.

0

But, How do i do that?

0

I'll try to post an answer

0

Try the code I edited for you, if it doesn't work tell me.

0

And make sure the gui is in the part.

1 answer

✓ Accepted answer
local partclicked = 0
script.Parent.Touched:connect(function(part)
    if partclicked == 0 then
    partclicked = 1
--A animation should play here, dont worry, ill make it.
    if not part.Parent then return end
    local humanoid = part.Parent:FindFirstChild("Humanoid")
    local player = game.Players:FindFirstChild(humanoid.Parent.Name) -- check for player
    if not humanoid or not player  then return end
    game.workspace.Boostsong.Playing = true
    humanoid.WalkSpeed = 0
    local gui = script.Parent:WaitForChild("DoubleBoostGUI"):Clone()
    gui.Parent = player.PlayerGui--In this part of the script, The player's "DoubleBoostGUI" screengui should get activated.
wait (6)
    humanoid.WalkSpeed = game.Workspace.BoostSpeed.Value
game.Workspace.Boosting.Value = true
wait(3)
partclicked = 1
end
end)

2 comments

0

Thank you!, It Works perfectly!, If i open the game, Would you like to see what i did?

0

Sure

This discussion is preserved as it was. New answers, comments, and votes are closed.