#My Slide Mechanic Isnt working

1 messages · Page 1 of 1 (latest)

golden lynx
#

I followed a tutorial but I don't know how to slide can someone tell me how

remote vessel
#

Place this in a LocalScript inside your GUI:

#

local TweenService = game:GetService("TweenService")
local frame = script.Parent -- Change this to your frame reference
local toggleButton = script.Parent.ToggleButton -- Change to your button

-- Initial positions (customize these)
local HIDDEN_POSITION = UDim2.new(-0.5, 0, 0.5, 0) -- Off-screen left
local VISIBLE_POSITION = UDim2.new(0.5, 0, 0.5, 0) -- Center screen

-- Set initial state
frame.Position = HIDDEN_POSITION
local isVisible = false

local function slide()
isVisible = not isVisible
local targetPosition = isVisible and VISIBLE_POSITION or HIDDEN_POSITION

local tweenInfo = TweenInfo.new(
    0.7, -- Duration (seconds)
    Enum.EasingStyle.Quint, -- Smooth easing
    Enum.EasingDirection.Out -- Ease out
)

local tween = TweenService:Create(frame, tweenInfo, {Position = targetPosition})
tween:Play()

end

-- Connect button click
toggleButton.MouseButton1Click:Connect(slide)

-- Optional: Add keybind (press "P" to toggle)
game:GetService("UserInputService").InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.P then
slide()
end
end)

#
  1. Create these UI elements:
    Frame (your sliding panel)
    TextButton (toggle button)

2Configure propertie

#

-- Frame Properties:
Size = UDim2.new(0.3, 0, 0.6, 0)
AnchorPoint = Vector2.new(0.5, 0.5)
BackgroundColor3 = Color3.fromRGB(40, 40, 40)

-- Button Properties:
Size = UDim2.new(0.1, 0, 0.05, 0)
Position = UDim2.new(0, 10, 0, 10)
Text = "Toggle Slide"

#

Add this to the TOP of your existing scripts to prevent errors

#

-- Fix nil errors (add before line 2 of your scripts)
if not workspace:FindFirstChild("Player_Pets") then
Instance.new("Folder", workspace).Name = "Player_Pets"
end

-- Fix DataStore errors (SERVER SCRIPT ONLY)
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("PlayerData")

game.Players.PlayerAdded:Connect(function(player)
local data = myDataStore:GetAsync(player.UserId) or {}
-- Load data here
end)

#

For WaitForChild infinite yield warnings: