Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

my gui is dissapearing and once it dissapear it cant reappear?

Asked by 2 years ago

the title explains it all

basically am making a morph gui. everything works except the gui, it appears, but once you click yes or no it dissapears and u cant appear it again.

how the gui appears: (theres alot of the same things but different with the location of click detector)

stillnot = false
local plrname

script.Parent.Torso.ClickDetector.MouseClick:Connect(function(plr)
    plr.PlayerGui.purchasemorph.Enabled = true
    plr.PlayerGui.purchasemorph.Frame.confirm.Text = "do you wanna wear Party Nugget for 150 dolar?"
    plr.PlayerGui.purchasemorph.morph.Value = "NuggetMorph"
    plr.PlayerGui.purchasemorph.cost.Value = 150
end)

heres another one for example

stillnot = false
local plrname

script.Parent.ClickDetector.MouseClick:Connect(function(plr)
    plr.PlayerGui.purchasemorph.Enabled = true
    plr.PlayerGui.purchasemorph.Frame.confirm.Text = "do you wanna wear Mr Been for 70 dolar?"
    plr.PlayerGui.purchasemorph.morph.Value = "BeenMorph"
    plr.PlayerGui.purchasemorph.cost.Value = 70
end)

now the buttons in the gui(yes and no options)

no:

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
end)

yes: (the one that send a remote event to wear the morph at server side)

script.Parent.MouseButton1Click:Connect(function()
    if game.Players.LocalPlayer.leaderstats.dolar.Value >= game.Players.LocalPlayer.PlayerGui.purchasemorph.cost.Value then
        game.ReplicatedStorage.MORPH:FireServer(game.Players.LocalPlayer, script.Parent.Parent.Parent.cost, script.Parent.Parent.Parent.morph)
    else
        game.Players.LocalPlayer.PlayerGui.purchasemorph.Enabled = false
    end
end)

now the serversided remote event checker:

game.ReplicatedStorage.MORPH.OnServerEvent:Connect(function(plr, cost, morph)
    if plr.leaderstats.dolar.Value >= plr.PlayerGui.purchasemorph.cost.Value then

            local model = workspace:FindFirstChild(plr.PlayerGui.purchasemorph.morph.Value)

            local oldCharacter = plr.Character
            local morphModel = model
            local newCharacter = morphModel:Clone()
            newCharacter.Name = plr.Name

            newCharacter.HumanoidRootPart.Anchored = false
            newCharacter:SetPrimaryPartCFrame(oldCharacter.PrimaryPart.CFrame)

            plr.Character = newCharacter
            newCharacter.Parent = workspace
            plr.PlayerGui.purchasemorph.Frame.Visible = false

    end
end)

please help am trying to figure out this for hours

Answer this question