the frame variable is supposed to be
local frame = game.StarterGui.ScreenGui.Frame
Also, I forgot to mention, use a global handler
and how do i make a global handler in this script? i didnât learn that part
That still does not work because the startergui is only for when a player joins the game it canât be changed when a player is already inside the game
Global handlers are regular scripts that are just grey
can you give me an example or type it into the script??
local clickdetector = script.Parent
local sound = script.Parent.Parent.Sound
local soundid = sound.SoundId
local clickdetector2 = script.Parent.Parent.Parent.Part.ClickDetector
clickdetector.MouseClick:Connect(function(player)
sound.Playing = true
print("1")
player.PlayerGui.ScreenGui.Frame.Visible = true
end)
clickdetector2.MouseClick:Connect(function(player)
sound.Playing = true
player.PlayerGui.ScreenGui.Frame.Visible = true
end)
do u have multiple screen guis
also, the click detector should be in the part u r trying to click.
If your localscript (inside the model) is a descendant of workspace, it wonât run. Use a Server Script for anything running in workspace
screw it, it wonât work because roblox keeps changing stuff and i canât figure it out like all i want it for the guiâs visible to be true so i can see it when i click the part. But of course it wonât let me do it cause it likes to do that.
your model is a local script, have you considered making it a âScriptâ instead?
this will most likely work;
local clickdetector = script.Parent.ClickDetector
local clickdetector2 = script.Parent.Part.ClickDetector
clickdetector.MouseClick:Connect(function(player)
player.PlayerGui.ScreenGui.Frame.Visible = true
end)
clickdetector2.MouseClick:Connect(function(player)
player.PlayerGui.ScreenGui.Frame.Visible = true
end)
i already did that but nothing works cause it wants to be annoying like all i should be able to do is this:
local frame = game.StarterGui.ScreenGui.Frame
local clickdetector = script.Parent
clickdetector.MouseClick:Connect(function()
frame.Visible = true
end)
HmâŚ, I donât know if this will work because I havenât test it BUT I hope it works. By the way, this script is in a normal script.
-- Variables
local clickdetector = script.Parent
local sound = script.Parent.Parent.Sound
local soundID = sound.SoundId
local clickdetector2 = script.Parent.Parent.Parent.Part.ClickDetector
-- Script
clickdetector.MouseClick:Connect(function(player) -- When the first click detector has been clicked
-- Variables
local Frame = player:WaitForChild("PlayerGui").ScreenGui.Frame
-- Script
sound:Play() -- Play the sound
Frame.Visible = true -- Make the frame visible
end)
clickdetector2.MouseClick:Connect(function(player) -- When the second click detector has been clicked
-- Variables
local Frame = player:WaitForChild("PlayerGui").ScreenGui.Frame
--script
sound:Play() -- Play the sound
Frame.Visible = true -- Make the frame visible
end)
I put some notes in the script so your not confuse. Hope this help .
ohh so thats what i needed to do. Btw it actually works now thanks
No problem. And by the way, you can make my reply a solution to help other people.