#Someone can help me?
35 messages · Page 1 of 1 (latest)
First code to open take the mask :
local Part = script.Parent
local ClickDetector = Part.ClickDetector
local opened = workspace.Configuration.Mask
ClickDetector.MouseClick:Connect(function(player)
local PlayerGui = player:FindFirstChild("PlayerGui")
local Mask = PlayerGui:FindFirstChild("Mask")
if opened.Value == false then
Part.Transparency = 1
opened.Value = true
Mask.ImageLabel.Visible = true
script.Parent.Sound:Play()
script.Parent.Sound.Volume = 0.5
Mask.ImageLabel.Visible = true
print("work")
end
end)
The code to remove the mask (i put this code on a imageButton)
local opened = workspace.Configuration.Mask
local Part = game:GetService("Workspace").Map.Mask
script.Parent.MouseButton1Click:Connect(function()
if opened.Value == true then
Part.Transparency = 0
opened.Value = false
game:GetService("StarterGui").Mask.ImageLabel.Visible = false
script.Parent.Sound:Stop()
script.Parent.Sound.Volume = 0
script.Parent.Visible = false
print("removed
")
end
end)
you're doing this at server startergui so i think you have to get a remote and do fireclient and do visible = false since the player has a local playergui
oh I don't understand everything I'm a beginner, so how i can get the remote?
you um just create a new remote and get it through RS then fire it to the client
remote function or remoteEvent
serverscript
local remote = game:GetService("ReplicatedStorage").RemoteEvent
remote:FireClient()```
localscript
```lua
local remote = game:GetService("ReplicatedStorage").RemoteEvent
local UI = game.Players.LocalPlayer.PlayerGui.Mask
remote.OnClientEvent:Connect(function()
UI.ImageLabel.Visible = false
end)```
where i put the second code?
** You are now Level 1! **
its not triggered
local Part = script.Parent
local ClickDetector = Part.ClickDetector
local opened = workspace.Configuration.Mask
local remote = game:GetService("ReplicatedStorage").RemoteEvent
script.Parent.MouseButton1Click:Connect(function()
if opened.Value == true then
Part.Transparency = 0
opened.Value = false
remote:FireClient()
script.Parent.Sound:Stop()
script.Parent.Sound.Volume = 0
script.Parent.Visible = false
print("removed")
end
end)
try it now
but this code is for open the gui and its work? i need to close
yes because it has the player argument
full access to the player
also I forgot, where is this originally placed?
i put this code on the maskPart
and for closed i put here
startergui right?
this is in starterGui
this on workspace
right
Workspace > Map > Mask
StaterGui > Mask
ok so this should be a localscript and why do you need to get the startergui; you can just do this
get playergui and disable the imagelabel visibility
local opened = workspace.Configuration.Mask
local Part = game:GetService("Workspace").Map.Mask
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if opened.Value == true then
Part.Transparency = 0
opened.Value = false
player.PlayerGui.Mask.ImageLabel.Visible = false
script.Parent.Sound:Stop()
script.Parent.Sound.Volume = 0
script.Parent.Visible = false
print("removed")
end
end)
i dont now, but where i put this so?
It's been a long time, I just started again so I don't really remember why I did that
into the localscript inside of the mask screengui or something
its not work
** You are now Level 2! **