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

How to make a part when touched make the backpack enabled?

Asked by 4 years ago
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
local Part = game.Workspace["Backpack?"]
Part.Touched:Connect(function(Hit)
local player = game.Players:GetPlayerFromCharacter(Hit.Part)
if player then
    game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end
end)


**** So that scripts that i wanted to try. I'll explain; first it makes the backpack disabled. then when a player touch a part called "BackPack?" it makes the backpack enabled again.. I couldn't continue the script when the player touch another part for example called "Return BackPack" It makes it disabled! Please I need this so badly. Thanks for reading/helping !

0
first thing u need to change is like 4, change (Hit.Part) to (Hit.Parent) Gameplayer365247v2 1055 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

I can't give you the complete code but I can give you the touched event

local backpack = script.Parent

backpack.Touched:Connect(function(hit)
    local humRoot = hit.Parent:WaitForChild("HumanoidRootPart", 10)
    if humRoot then
        --Code
    end
end)
0
Thanks! I'll try it out! fortesss7 40 — 4y
Ad

Answer this question