Technically, what I want is something like putting a mask on + the mask back off, similar to how you remove masks and put them, here is an example of what I want to achieve.
Before pressing the GUI:
After pressing the GUI:
That might be enough info I can give, I’m not really a scripter knowing that I’m bad at coding, lol.
is the helmet inside of the players character model or like a screenshot of how the hierarchy looks when its equipped, if so it wont be too hard
generally going through pseudo code, aka voicing out your code in steps is easier to format for yourself to figure out what u need to do and to use, but ill help where i can
You could put a local script in the hat of the morph, and when the morph is worn, it should pop up a gui, when the gui is clicked the hat can transform between Transparency = 1 and Transparency = 0 (or default for that hat)
problem is that’s all local, if he’s gonna apply in a game with other players that won’t work too good but if it’s for yourself it would although the transparency idea is correct
My simple last resort here is to make the hat transparent and visible again when clicked, I already have a code but I assume that it doesn’t work for hats.
Code:
local Handle = script.Parent
local CD = script.Parent.ClickDetector
function on ()
isOn = true
Handle.Transparency = 0
end
function off()
isOn = false
Handle.Transparency = 1
end
function onClicked()
if isOn == true then off() else on() end
end
CD.MouseClick:Connect(onClicked)
on()
well honestly, not a bad attempt! you’re close! we can use these on and off functions for the server script, the click detector we dont need. ultimately there should be a screengui in startergui with a frame and a button, with a localscript inside detecting whether the helmet is inside the players character model, then if the player clicks the button, send a remote event to the server script, we can put this is serverscriptservice, we can listen for the remote in the server and have it turn on or off based on a if statement similar to your OnClicked function!
for example:
LocalScript:
local button = script.Parent
local plr = game.Players.LocalPlayer
local character = plr.Character
local gui = button.Parent.Parent
local Remote = game.ReplicatedStorage.RemoteEvent
function Check()
if character.Handle then
gui.Enabled = true
return true
else
gui.Enabled = false
return false
end
end
function Send()
if Check() == true
Remote:FireServer(plr, Character.Handle)
print("sent")
else
return print("nil")
end
end
button.Activated:Connect(Send)
try the server script on your own! here’s a little starting tip in your server script! if you need help u can definitely ask of course
Server script tip:
local Remote = game.ReplicatedStorage.RemoteEvent
--previous functions that u had could work here
Remote.OnServerEvent:Connect(function(plr)
--previous functions that u had could work here
end
script.Parent.MouseButton1Click:Connect(function()
workspace.VaderMorph["Your hat that you want to remove"]:Destroy
script.Enabled = false
script.Parent.Parent.Enabled = false
end)
ultimately you’d need to make a ScreenGUI with a frame inside if that, and then a button inside of the frame, thats where the localscript goes, inside the button.
the server script goes in the helmet actually sorry*
and a remoteevent in the replicatedstorage