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

[PLEASE HELP] My script does nothing, Its supposed to make a frame visible, why wont work?

Asked by
OFF_S4LE 127
3 years ago

Please tweak my script This script is supposed to make a frame visible when you touch it, and when you stop touching it,
the frame goes away. It does nothing, why? note: this script is in a part, and the frame is in StarterGui > ScreenGui > [the Frame I'm talking about]

LocalScript:

part.Touched:connect(function()
        touched = true
    while true do
    StarterGui.ScreenGui.Frame.Visible = true
end)

This script is probably very confusing since its made by me

0
Lol Ziffixture 6913 — 3y
0
Lol (2x) sean_thecoolman 189 — 3y
0
Lol (math.huge) OFF_S4LE 127 — 3y
0
It is a little confusing.. By a little, I am a lot. EH2019SIT 78 — 3y

3 answers

Log in to vote
1
Answered by
FirezDevv 162
3 years ago

The real reason is the gui of the player is in player.PlayerGui so this would be the corrected version of the script

part.Touched:connect(function(hit)
  if hit.Parent:FindFirstChild("Humanoid") then -- [[Checking to make sure who touched was a player]]
            touched = true
        game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui.Frame.Visible = true
             end
    end)

Ad
Log in to vote
0
Answered by 3 years ago

Im sure your suppose to use the mouse button event and do you mean when its touched or hit?

0
By touched i mean when the playing touches the parent of the local script (part/brick) OFF_S4LE 127 — 3y
Log in to vote
0
Answered by 3 years ago

You should make the frame visible from the playerGui, you can find that folder inside the player. I think it's better to do that from the client. Also you should use the event TouchEnded for when the player stops touching the part.

Answer this question