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

How do you set a GUI to visible = true through touched function?

Asked by
1ov3y0u 51
4 years ago
Edited 4 years ago

Idk how to do it, I'm pretty new to scripting so. I don't have a script example, it's just a question. But anyway, here's my script, no errors its just not working

local part = game.Workspace.GunKill.Part
local gui = game.StarterGui.Deathgui.Frame
game.Players.PlayerAdded:Connect(function(plr)

part.Touched:Connect(function()
gui.Script.Disabled = false
part:Destroy()
    workspace.GunCock:Play()
    wait(5)
    workspace.Gunshot:Play()
    wait(2)
    plr:Kick("Ending 5, Killed Self")
end)
end)

GUI's script:

script.Parent.Visible = true
0
Why are you running a part.Touched function inside a PlayerAdded function? XxTrueDemonxX 362 — 4y

2 answers

Log in to vote
1
Answered by
Robowon1 323 Moderation Voter
4 years ago
script.Parent.Touched:connect(function(hit)
local plr = game.Players:FindFirstChild(hit.Parent.Name)
plr.PlayerGui.Deathgui.Frame.Script.Disabled = false
end)

not sure if you wanted to set a script to

disabled, just working off what you wrote

0
Alr, thanks. 1ov3y0u 51 — 4y
Ad
Log in to vote
0
Answered by
Loot_O 42
4 years ago

try this

partnamehere.Touched:Connect(function(hit)
       local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
       if plr then
               GUInamehere.Visible = true
       end
end
0
that wouldn't work, you have to reference the current PlayerGui, not the startergui Robowon1 323 — 4y

Answer this question