You are setting the frame to visible, but in the wrong path. Instead of setting it visible inside of StarterGui (all GUI elements inside of a ScreenGui placed inside of StarterGui are rendered when the player spawns inside of PlayerGui), set it visible in the player’s PlayerGui.
You can get the player from the argument passed on the MouseClick event.
ClickDetector.MouseClick:Connect(function( player )
-- do stuff
end)
Hmmm, Are the parts in a Model? Or you typed the variables in only Script? (Example: We have part 1 and part 2, You made the variables in a Script Inside of part 1)
Also, If it’s a Part/Brick you should use “MouseClick” And for GUIs “MouseButton1Click”
Here’s other Solutions!
Make sure you type “IsPlaying” Instead Of “Playing”
If you do Sound:Play() it plays the sound. It is not working because when there is an error in the start of the script it will not play the stuff below it.
i have two parts just in case they miss click and yes the script is only a script not a local script, is that the problem do i need to use the local script instead?
There’s a lot of problems with your script so I’ll list off as much as I can see.
First off you need to use WaitForChild(“ObjectName”) when locating things on the client. It may also be used on server scripts in some scenarios, but mainly the client.
You’re using MouseButton1Click on a ClickDetector. It’s supposed to be MouseClick bro…
If sound.Playing is not a member inside of sound, then it’s most likely a property you’re trying to access or a sound you’re trying to play. sound:Play(), or sound.IsPlaying = true is the solution to that.
local player = game.Players:FindFirstChild("Humanoid")
This will not do… You’re either trolling, or your username must be Humanoid. Why are you even locating player? player isn’t even used in the script…
here is the script: (still don’t make much sense plz don’t be mad)
can you remake this so i don’t have to waste so much time trying to figure the smallest and supposedly was easy?
local clickdetector = script.Parent.ClickDetector
local sound = script.Parent.Parent.Sound
local soundid = sound.SoundId
local clickdetector2 = script.Parent.Part.ClickDetector
local player = game.Players:FindFirstChild("Humanoid")
local frame = game
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)