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

For some reason the 'gui' is destroyed on respawn, no scripts or property is destroying it? [closed]

Asked by
Ben_B 9
4 years ago
Edited 4 years ago
local enabled = true
local ding = game.Workspace.Sounds.Ding             -- sound
local part = game.Workspace.Configuration.DesertScout1  -- name
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local PlayerGui = player:WaitForChild("PlayerGui")
local toolup = PlayerGui:WaitForChild("clickE")
local maxpickup = 20
local gui = PlayerGui.HatUI.DesertScoutAdd



    UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)

        local item = mouse.Target
        local distance = player:DistanceFromCharacter(item.Position)
if mouse.Target == part and enabled == true and distance <= maxpickup and input.KeyCode == Enum.KeyCode.E then
        ding:Play()
        gui.Enabled = true
        part.Position = Vector3.new(100,100,100)
        enabled = false

        part.Transparency = 1
        part.CanCollide = false

        game.ReplicatedStorage.HatEvent.DesertScoutEvent:FireServer()

wait(1)
        gui.Enabled = false
        enabled = true
        part.Transparency = 0
        part.CanCollide = true


end
    end)

Closed as Non-Descriptive by youtubemasterWOW and crywink

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 4 years ago

Hello. All gui's reset on spawn unless you set its ResetOnSpawn property to false. You don't even need a script for that.

0
I know, it is set to false Ben_B 9 — 4y
0
Well, you should've said more than just giving us your script. youtubemasterWOW 2741 — 4y
Ad