Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Note when the boss is killed, it won't get all if it did not have a double chest pass on (might fix when adding logic on fighting bosses)
- -- Global variables to control teleportation
- _G.PurpleChest = _G.PurpleChest or false -- true: Teleport to RaidChestSilver, false: Do nothing
- _G.GoldChest = _G.GoldChest or false -- true: Teleport to RaidChestGold, false: Do nothing
- _G.HaveDoubleChestPass = _G.HaveDoubleChestPass or false -- true: Can teleport to both, false: Cannot teleport to both
- -- Services
- local players = game:GetService("Players")
- local workspace = game:GetService("Workspace")
- -- Variables
- local raidChestSilverName = "RaidChestSilver"
- local raidChestGoldName = "RaidChestGold"
- local player = players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- -- Function to simulate clicking and teleporting to the chest
- local function simulateClick(chest)
- if character and chest then
- -- Ensure the player's character has a HumanoidRootPart
- local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
- if humanoidRootPart then
- -- Debug print to check if the player is detected and the chest is found
- print("Simulating click on chest...")
- -- Get the ChessBase part as the PrimaryPart
- local primaryPart = chest:FindFirstChild("ChestBase")
- if primaryPart then
- -- Directly set the player's CFrame to the chest's PrimaryPart (ChestBase)
- character:SetPrimaryPartCFrame(primaryPart.CFrame + Vector3.new(0, 5, 0)) -- Slight offset above chest
- -- Debug print to confirm the action
- print("Simulated click successful!")
- else
- print("ChestBase part not found!")
- end
- else
- print("HumanoidRootPart not found!")
- end
- end
- end
- -- Function to check for the chest's existence and simulate click
- local function checkAndClick()
- -- Check if both chests are set to true and if double chest pass is not enabled
- if _G.PurpleChest and _G.GoldChest then
- if not _G.HaveDoubleChestPass then
- print("Error: Can't have both RaidChestSilver and RaidChestGold enabled at the same time.")
- return
- end
- end
- -- Only proceed if PurpleChest is true
- if _G.PurpleChest then
- -- Find the RaidChestSilver in the workspace
- local chestSilver = workspace:FindFirstChild(raidChestSilverName)
- if chestSilver and chestSilver:IsA("Model") then
- -- Ensure the chest has the ChestBase PrimaryPart
- if chestSilver:FindFirstChild("ChestBase") then
- -- Simulate a click if chest exists
- print("RaidChestSilver found!")
- simulateClick(chestSilver)
- else
- print("RaidChestSilver found, but ChestBase part is missing.")
- end
- else
- print("RaidChestSilver not found.")
- end
- end
- -- Only proceed if GoldChest is true
- if _G.GoldChest then
- -- Find the RaidChestGold in the workspace
- local chestGold = workspace:FindFirstChild(raidChestGoldName)
- if chestGold and chestGold:IsA("Model") then
- -- Ensure the chest has the ChestBase PrimaryPart
- if chestGold:FindFirstChild("ChestBase") then
- -- Simulate a click if chest exists
- print("RaidChestGold found!")
- simulateClick(chestGold)
- else
- print("RaidChestGold found, but ChestBase part is missing.")
- end
- else
- print("RaidChestGold not found.")
- end
- end
- end
- -- Initial check when the script starts
- checkAndClick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement