so when you touch the lava instead of teleporting you to the correct position it teleports you to anything from 1,1,1 to 0,0,0
I cheaked with print spawnposition gives me the right value its something like 256,20ish, 0 and also does hidden value idk whats going wrong
local PlayerService = game:GetService("Players") script.Parent.Touched:Connect(function(hit) if hit.Parent:findFirstChild("Humanoid") then local HiddenValue = PlayerService:FindFirstChild(hit.Parent.Name).HiddenValues.CurrentLevel.Value local SpawnPosition = game.Workspace.Spawns:FindFirstChild(HiddenValue).Position hit.Parent.HumanoidRootPart.Position = Vector3.new(game.Workspace.Spawns:FindFirstChild(HiddenValue).Position) end end)
If you want to teleport a player to this location, you might want to try using CFrame
instead of Position
. Also, just to be safe, I always work with the head of a player, instead of messing with its HumanoidRootPart. This means you might need to add 1 or 2 to the y-value of your location.
local PlayerService = game:GetService("Players") script.Parent.Touched:Connect(function(hit) if hit.Parent:findFirstChild("Humanoid") then local HiddenValue = PlayerService:FindFirstChild(hit.Parent.Name).HiddenValues.CurrentLevel.Value local SpawnPosition = game.Workspace.Spawns:FindFirstChild(HiddenValue) hit.Parent.Head.CFrame = CFrame.new(SpawnPosition.Position) end end)
Let me know if this fixed anything.