Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- local player = game.Players.LocalPlayer
- local originalPosition = player.Character.HumanoidRootPart.CFrame
- local debrisFolder = game.Workspace:WaitForChild("Debris")
- local weaponDisplays = debrisFolder:GetChildren()
- local proximityPromptName = "ProximityPrompt"
- -- Function to teleport to a random WEAPON_DISPLAY
- local function teleportToRandomWeaponDisplay()
- -- Get all MeshParts named "WEAPON_DISPLAY" in the folder
- local weaponDisplayParts = {}
- for _, part in ipairs(weaponDisplays) do
- if part:IsA("MeshPart") and part.Name == "WEAPON_DISPLAY" then
- table.insert(weaponDisplayParts, part)
- end
- end
- -- Select a random weapon display from the list
- local randomWeaponDisplay = weaponDisplayParts[math.random(1, #weaponDisplayParts)]
- -- Teleport to the selected WEAPON_DISPLAY
- player.Character.HumanoidRootPart.CFrame = randomWeaponDisplay.CFrame
- end
- -- Function to interact with the ProximityPrompt and teleport back
- local function interactWithProximityPrompt()
- -- Find the ProximityPrompt inside the current WEAPON_DISPLAY
- local currentWeaponDisplay = player.Character:FindFirstChild("HumanoidRootPart")
- local proximityPrompt = currentWeaponDisplay and currentWeaponDisplay.Parent:FindFirstChild(proximityPromptName)
- if proximityPrompt then
- -- Trigger the ProximityPrompt interaction
- proximityPrompt.ActionTriggered:Connect(function()
- -- Teleport the player back to the original position
- player.Character.HumanoidRootPart.CFrame = originalPosition
- end)
- end
- end
- -- Call the functions
- teleportToRandomWeaponDisplay()
- wait(1) -- Wait a moment for teleportation
- interactWithProximityPrompt()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement