I've bin trying to make the teleport work so you get teleported if you have the game pass but the teleport isn't working at all, i keep getting frustrated on trying fixing it.
Heres the script
local Model = "teleporter1b";
if gamepassId = 299858716;
local MPS = game:GetService("MarketplaceService");
local function Check(Player)
return MPS:PlayerOwnsAsset(Player, passId);
end
script.Parent.Touched:connect(function(Touched)
if Touched.Parent ~= nil and Touched.Parent:FindFirstChild("Humanoid") ~= nil then
local tTo = script.Parent.Parent:FindFirstChild(Model);
if tTo ~= nil then
if Check(game.Players:FindFirstChild(Touched.Parent.Name) then
local location = {tTo.Position};
local i = 1;
local x = location[i].x;
local y = location[i].y;
local z = location[i].z;
x = x + math.random(-1, 1);
y = y + math.random(2, 3);
z = z + math.random(-1, 1);
local lx = 0;
local ly = y;
local lz = 0;
Touched.Parent.Torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz));
script.Parent.Enabled.Value = 0;
tTo.Enabled.Value = 0;
wait(3)
script.Parent.Enabled.Value = 1;
tTo.Enabled.Value = 1;
else
print("Insufficient permissions.");
end
else
print("Could not find teleporter!");
end
end
end)

1 comment
What's with all the huge gaps between declaring a variable and their values? Not helpful when reading it...