I have a script which has a value in it when activated it teleports the players back to the place they were in originally but it doesn’t seem to work?, This is the part of the script which I think is the problem :
repeat wait()
until script.GasterBlasterRing.Last == true
for i, v in pairs(game.Workspace:GetChildren()) do
local plr = game.Players:GetPlayerFromCharacter(v)
local humrp = v:FindFirstChild("HumanoidRootPart") or v:FindFirstChild("Torso")
if plr and humrp then
humrp.Parent = workspace.JudgementHall.PlayerPoint
end
end
The thing is it doesn’t output in an error so I’m confused?
local tool = script.Parent
repeat task.wait() until script.Parent
local targetfound = false
repeat task.wait() until script.Parent.Name ~= "SansAttacks"
local mag = 4000
local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
--local TargetPosition = script.Function:InvokeClient(player,"MousePos") -- gets the mouse position
--================TargetPosition========================
local players = game.Players:GetChildren()
local range = 500
local lastmag= 1000
local mTorso = script.Parent.Parent:FindFirstChild("Torso")
local mHum = script.Parent:FindFirstChild("Humanoid")
for i=1,#players do
task.wait()
if players[i].Character then
local char = players[i].Character
if char:FindFirstChild("Torso") then
local Torso = char:FindFirstChild("Torso")
local mag = (Torso.Position - script.Parent.Torso.Position).magnitude
if mag<=range then
if char.Name ~= script.Parent.Parent then
if mag < lastmag then
mag = (Torso.Position - script.Parent.Torso.Position).magnitude
lastmag = mag
TargetPosition = Vector3.new(Torso.Position.x,Torso.Position.y,Torso.Position.z)
targetfound = true
if targetfound == true then
local sanshumrp = script.Parent.HumanoidRootPart
for i, v in pairs(game.Workspace:GetChildren()) do
local plr = game.Players:GetPlayerFromCharacter(v)
local humrp = v:FindFirstChild("HumanoidRootPart") or v:FindFirstChild("Torso")
if plr and humrp then
if (sanshumrp.Position - humrp.Position).Magnitude < 4000 then -- paste here your magnitude
humrp.Position = workspace.BlackBox.Base.Position -- paste here the vector 3 or another position
task.wait()
script.GasterBlasterRing.OwnersName.Value = script.Parent.Name
wait()
local GToolModel = script["GasterBlasterRing"]:clone()
GToolModel.Parent = game.Workspace
repeat wait()
until script.GasterBlasterRing.Last == true
for i, v in pairs(game.Workspace:GetChildren()) do
local plr = game.Players:GetPlayerFromCharacter(v)
local humrp = v:FindFirstChild("HumanoidRootPart") or v:FindFirstChild("Torso")
if plr and humrp then
humrp.Parent = workspace.JudgementHall.PlayerPoint
end
end
end
end
end
end
end
end
end
end
end
end -- end of for loop
This is the entire script and this is the children of the script.
Help would be massively appreciated thank you so much!