Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to trigger a ScreenGui with this Script?

Asked by 6 years ago

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

0
Try cloning the gui into PlayerGui. 522049 152 — 6y
0
The GUI is on The StarterGUI, So it gets cloned to playerGUI. Chris75764 49 — 6y
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. 522049 152 — 6y
0
But, How do i do that? Chris75764 49 — 6y
View all comments (3 more)
0
I'll try to post an answer 522049 152 — 6y
0
Try the code I edited for you, if it doesn't work tell me. 522049 152 — 6y
0
And make sure the gui is in the part. 522049 152 — 6y

1 answer

Log in to vote
0
Answered by
522049 152
6 years ago
Edited 6 years ago
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)
0
Thank you!, It Works perfectly!, If i open the game, Would you like to see what i did? Chris75764 49 — 6y
0
Sure 522049 152 — 6y
Ad

Answer this question