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

onTouch trying to call out a dialog not working?

Asked by 6 years ago
local brick = game.workspace.DialogPart

function dialog()
local CustomDialog = Instance.new("ScreenGui")
local Frame = Instance.new("Frame")
local TextLabel = Instance.new("TextLabel")
local ImageLabel = Instance.new("ImageLabel")
CustomDialog.Name = "Custom Dialog"
CustomDialog.Parent = game.StarterGui
Frame.Parent = CustomDialog
Frame.BackgroundColor3 = Color3.new(1, 1, 1)
Frame.Position = UDim2.new(0, 0, 0, 500)
Frame.Size = UDim2.new(0, 1450, 0, 100)
Frame.Style = Enum.FrameStyle.DropShadow
TextLabel.Parent = Frame
TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
TextLabel.BackgroundTransparency = 1
TextLabel.Position = UDim2.new(0, 600, 0, 15)
TextLabel.Size = UDim2.new(0, 200, 0, 50)
TextLabel.Font = Enum.Font.SciFi
TextLabel.Text = "text"
TextLabel.TextColor3 = Color3.new(1, 1, 1)
TextLabel.TextSize = 64
ImageLabel.Parent = Frame
ImageLabel.BackgroundColor3 = Color3.new(1, 1, 1)
ImageLabel.BackgroundTransparency = 1
ImageLabel.Position = UDim2.new(0.724827588, 0, -2.02999997, 0)
ImageLabel.Size = UDim2.new(0, 300, 0, 300)
ImageLabel.Image = "rbxassetid://560122118"
end

function onTouch()
        dialog()
    end

brick.Touched:connect(onTouch)

Here's what i'm working with. Doesen't do anything, no errors, nothing. Help?

0
Why use a function leading to another function leading to another? You could use brick.Touched:connect(dialog) so yeah, it doesn't have to be named "onTouch" User#20388 0 — 6y
0
is FE on? (filtering enabled) User#20388 0 — 6y
0
I think it is. Gonna try your (dialog) UncleBenss -3 — 6y
0
And yet still not working UncleBenss -3 — 6y

1 answer

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

A few things your doing wrong, to start with, it would be better to have the gui already, then you can clone it to the player.

Inside the brick you want to put the gui you made and a script (serverscript)

local brick = script.Parent
local gui = script.Parent.Dialog -- Change this if you want
Debounce = true

brick.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and Debounce  then -- verify that it is a player and that debounce is true
        Debounce = false
        local char = hit.Parent
        local plr = game.Players:GetPlayerFromCharacter(char)

        if not plr.PlayerGui:FindFirstChild("Dialog") then
            local DialogClone = Dialog:Clone()
            DialogClone.Name = "Dialog"
            DialogClone.Parent = plr.PlayerGui
        end
        Debounce = true
    end
end)

If I made a mistake in typing this, ask me xD I hope this works for you, if you want to do this your way though you'll have to work with remote events I guess and change "game.StarterGui" to player.PlayerGui because startergui will only be copied to the playergui on dead. I could try to remake your script but I believe mine would be a lot better, if you have any questions just ask

0
Works perfectly! Just had to change local gui to local dialog and everything worked perfectly! Thanks! UncleBenss -3 — 6y
0
No problem User#20388 0 — 6y
Ad

Answer this question