I have this problem can anyone help me plz here is my code
local TeleportService = game:GetService("TeleportService") local part = script.Parent part.Touched:Connect(function(hit) local human = hit.Parent:FindFirstChild("Humanoid") if human then local char = hit.Parent local player = game.GetPlayerFromCharacter(hit.Parent) TeleportService:Teleport(7092017722, player) end end)
:GetPlayerFromCharacter()
can only be used from the players service. The error basically says the same thing.
This is how you use it:
local Players = game:GetService("Players") local Character = workspace.Character local player = Players:GetPlayerFromCharacter(Character) print(player.Name)
Marked as Duplicate by NGC4637, Soban06, radiant_Light203, and appxritixn
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?