So I have this script where if you own specific badges it’ll teleport you to a part & will also do other things, now everything in the script is working fine except for the part where it teleports me, I always end up outside or not exactly where the part is positioned, how do I fix that so that I always get teleported to exactly where the part is? (the part is called FinalTP under Workspace)
Current server script (inside a part inside a model):
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local BadgeService = game:GetService("BadgeService")
local rs = game:GetService("ReplicatedStorage")
local model = rs:WaitForChild("Podium") --change to name of model in replicated storage
local pos = game.Workspace.PosPoint.CFrame
local Badges = {2147284665, 2147284674, 2147284683, 2147313047, 2147313055} -- Put your badgeID's here
local dbs = {}
local function hasBadges(plr)
for _,badge in pairs(Badges) do
local success, hasBadge = pcall(function()
return BadgeService:UserHasBadgeAsync(plr.UserId, badge)
end)
if success and not hasBadge then
return false
end
end
return true
end
script.Parent.Touched:Connect(function(obj)
local plr = Players:GetPlayerFromCharacter(obj.Parent)
if plr then
if not dbs[plr.Name] then
dbs[plr.Name] = true
if hasBadges(plr) then
print(plr.Name.." has all the required badges.")
local h = obj.Parent:FindFirstChild("Humanoid")
if (h~=nil) then
h.Parent:SetPrimaryPartCFrame(workspace.FinalTP.CFrame)
end
model.Parent = workspace
model:SetPrimaryPartCFrame(pos.CFrame)
else
print(plr.Name.." does NOT have all the required badges.")
end
dbs[plr.Name] = false
end
end
end)