Hello developers, I am trying to accomplish a support script with a teleportation button. However, the teleportation part doesn’t seem to work.
local Player = game.Players.LocalPlayer
game.ReplicatedStorage.HelpNotifierEvent.OnClientEvent:Connect(function(PlayerNeedingHelp)
local playerRoot = Player.Character:FindFirstChild('HumanoidRootPart')
local a = Player
local b = Player
local playerRoot = Player.Character:FindFirstChild('HumanoidRootPart')
local bHumanoid, bHumanoidRootPart = b.Character:FindFirstChildOfClass("Humanoid"), b.Character:FindFirstChild("HumanoidRootPart")
local TeleportPlayer = Instance.new("BindableFunction")
TeleportPlayer.OnInvoke = function()
bHumanoidRootPart.CFrame = (playerRoot.CFrame*CFrame.Angles(0,math.rad(90/#Player*a),0)*CFrame.new(5+.2*#Player,0,0))*CFrame.Angles(0,math.rad(90),0)
end
game.StarterGui:SetCore("SendNotification", {
Title = "Player Needs Help",
Text = PlayerNeedingHelp.Name .. " is in need of assistance.",
Duration = 15,
Button1 = "Teleport",
Callback = TeleportPlayer
})
end)