Hey there! Very amateur scripter who knows basic stuff and mainly uses youtube tutorials to make scripts! I'm having a bit of trouble getting this one to work. It doesn't properly run despite not having any noticeable flaws in ROBLOX studio, can anybody help me out with this?
local placeID_1 = 6305834065 local TeleportService = game:GetService("TeleportService") local Owner = "FrigidusIncendium, Strawberrymlqq" local function onPartTouch(otherPart) script.Parent.Touched:Connect(onPartTouch) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player == Owner then TeleportService:Teleport(placeID_1, player) end end
Thanks!
You should use a table instead of a string, if you don't know what a table is, it's something you can store many different values inside such as strings, booleans, numbers, etc. If you store your name (or others) inside the table you can then use table.find()
whenever a player touches the part to check if their name is inside the table, if it doesn't find their name inside the table then it'll return nil, otherwise, if it does find their name in the table then it'll return the index position of it.
local placeID_1 = 6305834065 local TeleportService = game:GetService("TeleportService") local Owner = {"FrigidusIncendium", "Strawberrymlqq"} local function onPartTouch(otherPart) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player then if table.find(Owner, player.Name) then TeleportService:Teleport(placeID_1, player) end end end script.Parent.Touched:Connect(onPartTouch)