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

on touch make a gui appear and insert something to player?

I made the both scripts but they didnt work ? asked it before understand it now its cause cant do 2 things with 1 scrits but how do do that basicaly

local Model = script.Parent
local SafeZoneDetector = Model
SafeZoneDetector.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("HumanoidRootPart") and hit.Parent:FindFirstChild ("SafeZone Protection") == nil then
        local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
        local Forcefield = Instance.new("ForceField")
        Forcefield.Name = "SafeZone Protection"
        Forcefield.Visible = false
        Forcefield.Parent = hit.Parent
    end
end)
SafeZoneDetector.TouchEnded:Connect(function(hit)
 wait (60)
    if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("HumanoidRootPart") and hit.Parent:FindFirstChild ("SafeZone Protection") == nil then
        hit.Parent:FindFirstChild("SafeZoneProtection"):Destroy()
    end
end) 

But ? also need a gui to get shown too help

9 comments

0

I don't see the problem yet, please explain more.

0

? need a gui to pop up with the same function on this script

0

Does the gui disappear when you leave the safezone and where is this gui located and what is it called?

0

Add the gui

0

There's the problem, he can't.

0

1.StarterGui.ScreenGui.Frame.Unsafed+Bar and ? need a 2nd entering safe zone will also make StarterGui.ScreenGui.Frame.Safed visible

0

So Unsafed is visible at the start and Safed isn't?

0

They both arent when you touch the script.Parent 1st gui gets visible and when you get out 2nd gui gets visible and it shrinks

0

I made it pretty simple as I did not see the comment while I made the answer.

1 answer

To make the solution easier to see after a long comment conversation I just decided to make an answer:

Add this under line 5:

game:GetService("Players"):GetPlayerFromCharacter(hit.Parent).PlayerGui.ScreenGui.Frame.Unsafed.Visible = false
game:GetService("Players"):GetPlayerFromCharacter(hit.Parent).PlayerGui.ScreenGui.Frame.Safed.Visible = true

And add this under line 13

game:GetService("Players"):GetPlayerFromCharacter(hit.Parent).PlayerGui.ScreenGui.Frame.Unsafed.Visible = true
game:GetService("Players"):GetPlayerFromCharacter(hit.Parent).PlayerGui.ScreenGui.Frame.Safed.Visible = false

2 comments

0

?nserting a force field is a normal script but making a gui visible is a local scirpt

0

Actually, it's not.

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