What do you want to achieve? That the player by touching a block to another place in the place
What is the issue? It bugs the player out
Video:
What solutions have you tried so far? I’ve tried looking but I didn’t find anything
Teleport Script:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(18.911, 19.693, 102.484)
wait()
end
end)
Nope, although he is now only being fired once (the teleport event) it is still bugging the player out.
EDIT: Maybe I am doing something wrong so here is the new code:
local RESET_SECONDS = 5
local isTouched = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if not isTouched then
isTouched = true
hit.Parent.HumanoidRootPart.CFrame = CFrame.new(18.911, 19.693, 102.484)
print("Touched!")
wait(RESET_SECONDS)
isTouched = false
end
end
end)
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then
hit.Parent.HumanoidRootPart.CFrame = partTwo.CFrame + partTwo.CFrame.LookVector * 4 -- Telepports the player a few studs away from the part, so it doesn't result in spam teleporting.
--also change the "partTwo" with the part that you want to teleport to.
end
end)
local spawn = script.Parent
spawn.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local checkpointData = game.ServerStorage:FindFirstChild("CheckpointData")
if not checkpointData then
checkpointData = Instance.new("Model", game.ServerStorage)
checkpointData.Name = "CheckpointData"
end
local checkpoint = checkpointData:FindFirstChild(tostring(player.userId))
if not checkpoint then
checkpoint = Instance.new("ObjectValue", checkpointData)
checkpoint.Name = tostring(player.userId)
player.CharacterAdded:connect(function(character)
wait()
character:WaitForChild("HumanoidRootPart").CFrame = game.ServerStorage.CheckpointData[tostring(player.userId)].Value.CFrame + Vector3.new(0, 4, 0)
end)
end
checkpoint.Value = spawn
end
end)
Acvious could be correct. If a Debonce variable or a Vector displace meant does not work. Then the other solution might be another script interference.