Ok so my goal is to onActivation of the tool to take away 25 hp and teleport the player.
Problem is it does teleport the player however it makes the invisible/completely transparent and flings them whenever they move.
Are there any alternative solution to the script I made so I can safely teleport the player without it going invisible nor flinging?
local Tool = script.Parent
local Player = game.Players.LocalPlayer.Character
local script = Tool.TeleportScript
function onActivation()
local deb = false
local x = math.random(1,991)
local y = math.random(3,3)
local z = math.random(1,991)
local newPos = Vector3.new(x,y,z)
if deb == false then
deb = true
local humanoid = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
Player.HumanoidRootPart.Position = newPos
Player.Humanoid:TakeDamage(25)
wait(5)
deb = false
if Player.Humanoid.Health > 0 then
script.Disabled = true
else
script.Disabled = false
end
end
end
Tool.Activated:Connect(onActivation)

1 comment
You should use CFrame.new(x,y,z) instead of Vector3.new(x,y,z). Adding to that, you should also use Player.HumanoidRootPart.CFrame = newPos instead.