Hey. I have following Problem. I did a LocalScript, which teleports the player to a mat. Now, it does not teleport the player to the seat.
Thats the script:
--Teleport to mats local function TeleportToMat() local player = game.Players.LocalPlayer local char = player.Character if not char or not char.Parent then char = player.CharacterAdded:wait() end char.Position:SetPrimaryPartCFrame(workspace.Mat1.Position) end local RemoteEvent = game.ReplicatedStorage.RemoteFunction RemoteEvent.OnClientEvent:Connect(TeleportToMat())
Try this:
local whereTo = workspace:FindFirstChild('Mat1') if whereTo then char:SetPrimaryPartCFrame(whereTo.CFrame) end
This will ONLY WORK if 'Mat1' is a part and NOT a model
Edited:
local function TeleportToMat() local player = game.Players.LocalPlayer local char = player.Character --if not char or not char.Parent then -- char = player.CharacterAdded:wait() --end repeat wait() char = player.Character until char ~= nil char:SetPrimaryPartCFrame(workspace.Mat1.CFrame) -- Changed that to what I set, Remember MUST BE A BASEPART NOT A MODEL end local RemoteEvent = game.ReplicatedStorage.RemoteFunction RemoteEvent.OnClientEvent:Connect(TeleportToMat) -- Set this to TeleportToMat