I have a script that when clicked, teleports you, and plays an animation, but it still allows you to pull out tools, which is unrealistic for my game. Any help? Here is my script
dog = false
script.Parent.MouseClick:Connect(function(player)
if dog == false then
dog = true
local character = player.Character
character.HumanoidRootPart.CFrame = game.Workspace.TeleportPart.CFrame
character.HumanoidRootPart.Anchored = true
game.Workspace.ChinUpBar.CanCollide = false
player.PlayerGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
local animation = character.Humanoid:LoadAnimation(script.Animation)
animation:Play()
wait(13)
animation:Stop()
character.HumanoidRootPart.Anchored = false
game.Workspace.ChinUpBar.CanCollide = true
dog = false
end
end)

4 comments
SetCoreGuiEnabled is a StarterGui function, not a PlayerGui. Use remotes to disable a certain player's backpack.
Fixed indentation. https://forum.scriptinghelpers.org/topic/792/how-to-indent-properly
I already answered this with my long answer and you deleted the question so im just going to give you the example: https://web.roblox.com/games/3266086881/Disable-Backpack
Alright thank you both.