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

How can I turn a button dialogue into a gui? (Details in description)

Asked by
notfenv 171
4 years ago

So I am making a border game and im gonna make a gui where if you click that text button it makes you say the dialogue, In this case I am using my normal script where you click a brick to get it in-game, Here is the click the brick script.

local LastNext = tick()
script.Parent.ClickDetector.MouseClick:connect(function(Player)
    if (not Player.Team or Player.Team.Name == 'Admission') and tick()-LastNext > 3 then
        workspace:WaitForChild('BoothSFX').Present:Play()
        game:GetService("Chat"):Chat(Player.Character,'Papers, Please.', 'White')
        LastNext = tick()
    end
end)

So how would I turn this into a GUI button instead of a brick?

Person: Clicks text button Then it makes them say what was in that script.

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

the mouse click event pass in the player object, so you can do everything with the player. Let us say you have put your dialog into a DialogGUI in replicated storage


local LastNext = tick() script.Parent.ClickDetector.MouseClick:connect(function(Player) if (not Player.Team or Player.Team.Name == 'Admission') and tick()-LastNext > 3 then local gui = game.ReplicatedStorage.DialogGUI:Clone() gui.Parent = player.PlayerGui gui.Enabled = true LastNext = tick() end end)
Ad

Answer this question