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

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

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

4 comments

0

Lol

0

Lol (2x)

0

Lol (math.huge)

0

It is a little confusing.. By a little, I am a lot.

3 answers

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)

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

1 comment

0

By touched i mean when the playing touches the parent of the local script (part/brick)

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.

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