Got an issue where whenever you enter the shop GUI it does put a forcefield on the character but then when the gui is disabled the forcefield stays on the player even though I do oldforcefield:Destroy()
Heres the script
local proximity = workspace.StuffShop.ShopStepin.ProximityPrompt
local ProximityPromptService = game:GetService("ProximityPromptService")
local plr = game.Players.LocalPlayer
local character = plr.Character
local torso = character:WaitForChild("Torso")
proximity.Triggered:Connect(function()
-- THIS IS WHERE THE FORCEFIELD GETS PUT INTO THE PLAYER
local GUI = script.Parent:WaitForChild("Shop Gui")
GUI.Enabled = not GUI.Enabled
torso.Anchored = true
local forcefield = Instance.new('ForceField')
forcefield.Parent = character
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
if GUI.Enabled == false then
torso.Anchored = false
local oldforcefield = character.WaitForChild("ForceField")
oldforcefield:Destroy()
-- THIS IS WHEN THE OLD FORCEFIELD GETS DESTROYED
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
end
end)