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 5 years ago
1game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
2local Part = game.Workspace["Backpack?"]
3Part.Touched:Connect(function(Hit)
4local player = game.Players:GetPlayerFromCharacter(Hit.Part)
5if player then
6    game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
7end
8end)

**** 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 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

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

Answer this question