so i’m trying to make a script so that yo can teleport to your current stage and i find this very confusing, can anyone adapt to my script please?
Script1 local side:
task.wait(3)
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local tweenService = game:GetService(“TweenService”)
local teleportFrame = script.Parent:WaitForChild(“TeleportFrame”)
local scrollingFrame = teleportFrame:WaitForChild(“ScrollingFrame”)
local transition = script.Parent:WaitForChild(“Transition”)
local debounce = false
local function Teleport(button)
if debounce then
return
end
debounce = true
transition.Visible = true
transition.BackgroundTransparency = 1
tweenService:Create(transition, TweenInfo.new(0.8), {BackgroundTransparency = 0}):Play()
task.wait(0.9)
local result = replicatedStorage.Teleport:InvokeServer(button.Name)
task.wait(2)
tweenService:Create(transition, TweenInfo.new(0.8), {BackgroundTransparency = 1}):Play()
if result == true then
print("true")
else
print("false")
end
task.wait(0.8)
transition.Visible = false
debounce = false
end
for _, v in scrollingFrame:GetChildren() do
if not v:IsA(“Frame”) then continue end
v.TextButton.MouseButton1Click:Connect(function()
Teleport(v)
end)
end
Script2serverside:
local replicatedStorage = game:GetService(“ReplicatedStorage”)
replicatedStorage.Teleport.OnServerInvoke = function(player, area)
local charcter = player.Character or player.CharacterAdded:Wait()
if charcter == nil or not workspace.TeleportPoints:FindFirstChild(area) then
return
end
if charcter:FindFirstChild("Humanoid") and charcter.Humanoid.Health > 0 then
charcter.HumanoidRootPart.CFrame = workspace.TeleportPoints[area].CFrame
return true
end
end