#Someone can help me?

35 messages · Page 1 of 1 (latest)

ruby aspen
#

I would like to make sure that when we take the mask it takes it, this system works but I can't make it so that when we click it removes it, could someone help me?

#

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)
outer sun
ruby aspen
outer sun
ruby aspen
#

remote function or remoteEvent

outer sun
#

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)```
ruby aspen
warm shellBOT
#

studio** You are now Level 1! **studio

outer sun
#

its written

ruby aspen
outer sun
# ruby aspen

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

ruby aspen
outer sun
#

full access to the player

ruby aspen
#

so where i put your code?

#

in the imageButton?

outer sun
ruby aspen
#

and for closed i put here

outer sun
ruby aspen
ruby aspen
outer sun
#

right

ruby aspen
ruby aspen
outer sun
# ruby aspen ## The code to remove the mask (i put this code on a imageButton) ```lua local o...

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)
ruby aspen
#

It's been a long time, I just started again so I don't really remember why I did that

outer sun
warm shellBOT
#

studio** You are now Level 2! **studio