Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character or player.CharacterAdded:Wait()
- local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
- local camera = game:GetService("Workspace").CurrentCamera
- local userInputService = game:GetService("UserInputService")
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "PhantomGUI"
- screenGui.Parent = player:WaitForChild("PlayerGui")
- local frame = Instance.new("Frame")
- frame.Size = UDim2.new(0, 300, 0, 150)
- frame.Position = UDim2.new(0.5, -150, 0.5, -75)
- frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- frame.BackgroundTransparency = 0.5
- frame.Parent = screenGui
- local button = Instance.new("TextButton")
- button.Size = UDim2.new(0, 200, 0, 50)
- button.Position = UDim2.new(0.5, -100, 0.2, 0)
- button.Text = "Become a Phantom"
- button.Parent = frame
- local isPhantom = false
- local originalPosition = humanoidRootPart.Position
- local function togglePhantom()
- if isPhantom then
- for _, part in ipairs(character:GetChildren()) do
- if part:IsA("BasePart") then
- part.Transparency = 0
- part.CanCollide = true
- end
- if part:IsA("Accessory") then
- local handle = part:FindFirstChild("Handle")
- if handle then
- handle.Transparency = 0
- end
- end
- end
- humanoidRootPart.CFrame = CFrame.new(originalPosition)
- isPhantom = false
- button.Text = "Become a Phantom"
- else
- for _, part in ipairs(character:GetChildren()) do
- if part:IsA("BasePart") then
- part.Transparency = 1
- part.CanCollide = false
- end
- if part:IsA("Accessory") then
- local handle = part:FindFirstChild("Handle")
- if handle then
- handle.Transparency = 1
- end
- end
- end
- originalPosition = humanoidRootPart.Position
- isPhantom = true
- button.Text = "Return to Place"
- end
- end
- button.MouseButton1Click:Connect(togglePhantom)
- local dragging = false
- local dragInput, dragStart, startPos
- local function update(input)
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- dragging = true
- dragStart = input.Position
- startPos = frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- frame.InputChanged:Connect(function(input)
- if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
- update(input)
- end
- end)
- local nickname = Instance.new("TextLabel")
- nickname.Size = UDim2.new(0, 200, 0, 50)
- nickname.Position = UDim2.new(0.5, -100, 0.8, 0)
- nickname.Text = "YT: Stevevan090"
- nickname.TextColor3 = Color3.fromRGB(255, 255, 255)
- nickname.BackgroundTransparency = 1
- nickname.Parent = frame
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement