-
What do you want to achieve?
I want it to teleport to the part after reactivating the function again -
What is the issue?
I don’t know how to implement it to be compatible with multiple players. -
What solutions have you tried so far?
I tried to make the teleport function a global function so i can fire the Teleport function but when theres 2 players that tries to teleport it kinda get messes up such as the 2nd player will not be able to teleport once the 1st person reactivates it
Tried
local Cooldown = {}
return function(Player)
if not Cooldown[Player] == false then Teleport() return end
Cooldown[Player] = true
local Part = script.MeshPart:Clone()
Part.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-3)
Part.Parent = game.Workspace
local Tween = game.TweenService:Create(Part, TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = Part.CFrame*CFrame.new(0,0,-50)})
Tween:Play()
game.Debris:AddItem(Part, 5)
local Teleported = false
function Teleport()
if Teleported == false then
Teleported = true
Player.Character.HumanoidRootPart.CFrame = Part.CFrame
end
end
Tween.Completed:Wait()
if Teleported == false then
Teleported = true
Teleport()
end
wait(2)
Cooldown[Player] = false
end
Original
local Cooldown = {}
return function(Player)
if not Cooldown[Player] == false then --[[Teleport Script that i don't know how to implement]] return end
Cooldown[Player] = true
local Part = script.MeshPart:Clone()
Part.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-3)
Part.Parent = game.Workspace
local Tween = game.TweenService:Create(Part, TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = Part.CFrame*CFrame.new(0,0,-50)})
Tween:Play()
game.Debris:AddItem(Part, 5)
local Teleported = false
local function Teleport()
Teleported = true
Player.Character.HumanoidRootPart.CFrame = Part.CFrame
end
Tween.Completed:Wait()
if Teleported == false then
Teleported = true
Teleport()
end
wait(2)
Cooldown[Player] = false
end