local player = game.Players.LocalPlayer
local TweenService = game:GetService("TweenService")
-- Vérifier si le GUI existe déjà
local screenGui = player.PlayerGui:FindFirstChild("TeleportGui")
if not screenGui then
screenGui = Instance.new("ScreenGui")
screenGui.Name = "TeleportGui"
screenGui.ResetOnSpawn = false
screenGui.Parent = player:WaitForChild("PlayerGui")
end
-- ===== Frame principale pour le bouton =====
local buttonFrame = screenGui:FindFirstChild("ButtonFrame")
if not buttonFrame then
buttonFrame = Instance.new("Frame")
buttonFrame.Name = "ButtonFrame"
buttonFrame.Parent = screenGui
buttonFrame.Size = UDim2.new(0, 120, 0, 35)
buttonFrame.Position = UDim2.new(0, 50, 0, 50)
buttonFrame.BackgroundTransparency = 1
end
-- ===== Bouton TP =====
local button = buttonFrame:FindFirstChild("TeleportButton")
if not button then
button = Instance.new("TextButton")
button.Name = "TeleportButton"
button.Parent = buttonFrame
button.Size = UDim2.new(1, 0, 1, 0)
button.Position = UDim2.new(0, 0, 0, 0)
button.Text = "Teleport"
button.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
button.TextColor3 = Color3.fromRGB(0, 120, 255)
button.TextScaled = true
button.BorderSizePixel = 0
local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 8)
buttonCorner.Parent = button
end
-- ===== Texte du créateur juste en dessous du bouton =====
local creditText = screenGui:FindFirstChild("CreditText")
if not creditText then
creditText = Instance.new("TextLabel")
creditText.Name = "CreditText"
creditText.Parent = screenGui
creditText.Size = UDim2.new(0, 60, 0, 15)
creditText.Position = UDim2.new(0, 50, 0, 90)
creditText.Text = "By Shaun"
creditText.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
creditText.BackgroundTransparency = 0.1
creditText.TextColor3 = Color3.fromRGB(255, 255, 255)
creditText.TextScaled = true
creditText.TextStrokeTransparency = 0.7
creditText.TextXAlignment = Enum.TextXAlignment.Center
creditText.TextYAlignment = Enum.TextYAlignment.Center
creditText.BorderSizePixel = 0
local creditCorner = Instance.new("UICorner")
creditCorner.CornerRadius = UDim.new(0, 5)
creditCorner.Parent = creditText
end
-- ===== TextBoxes pour x, y, z =====
local coords = {"X", "Y", "Z"}
local inputBoxes = {}
for i, coord in ipairs(coords) do
local box = screenGui:FindFirstChild(coord.."Box")
if not box then
box = Instance.new("TextBox")
box.Name = coord.."Box"
box.Parent = screenGui
box.Size = UDim2.new(0, 50, 0, 35)
box.Position = UDim2.new(0, 180 + (i-1)*55, 0, 50)
box.PlaceholderText = coord
box.Text = "0"
box.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
box.TextColor3 = Color3.fromRGB(255, 255, 255)
box.TextScaled = true
box.BorderSizePixel = 0
local inputCorner = Instance.new("UICorner")
inputCorner.CornerRadius = UDim.new(0, 8)
inputCorner.Parent = box
end
table.insert(inputBoxes, box)
end
-- ===== Fonction teleport =====
button.MouseButton1Click:Connect(function()
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local x = tonumber(inputBoxes[1].Text)
local y = tonumber(inputBoxes[2].Text)
local z = tonumber(inputBoxes[3].Text)
if x and y and z then
hrp.CFrame = CFrame.new(Vector3.new(x, y, z))
else
warn("Coordonnées invalides ! Assurez-vous que X, Y, Z sont des nombres.")
end
end)
-- ===== Animation hover bouton centrée =====
local hoverTweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local originalSize = button.Size
local originalPosition = button.Position
local hoverSize = UDim2.new(originalSize.X.Scale, originalSize.X.Offset + 10, originalSize.Y.Scale, originalSize.Y.Offset + 5)
local hoverPosition = UDim2.new(originalPosition.X.Scale, originalPosition.X.Offset - 5, originalPosition.Y.Scale, originalPosition.Y.Offset - 2.5)
local hoverTween = TweenService:Create(button, hoverTweenInfo, {Size = hoverSize, Position = hoverPosition})
local unhoverTween = TweenService:Create(button, hoverTweenInfo, {Size = originalSize, Position = originalPosition})
button.MouseEnter:Connect(function()
hoverTween:Play()
end)
button.MouseLeave:Connect(function()
unhoverTween:Play()
end)