Teleport to Map pad doesn't work?

I made a simple script to make a Teleport pad Duplicate something in ServerStorage and put the duplicate in the workspace for the player to teleport to.
This is my script:

script.Parent.Touched:Connect(function(hit)

local ws = game.Workspace

local Clone = game.ServerStorage.Maps.GrassIsles:Clone()

Clone.Parent = ws

local h = game.Players:GetPlayerFromCharacter().HumanoidRootPart

h.Position = Clone

end)

Please help me out here!

Clone is not a Vector3, you can’t move it this way. You’d have to move the player to Clone.Position or to the position in something inside Clone.

  1. Anything in the output?

No. Nothing in the output. But I could try adding a part in the Map to teleport to?

You didn’t specify anything in GetPlayerFromCharacter, It’s better to get the character immediately using Hit.Parent. And you really need a debounce for this as it’ll do this multiple times in one go

I recommed this

local deb = false

script.Parent.Touched:Connect(function(hit)
	local char = hit.Parent
	local root = char:FindFirstChild("HumanoidRootPart")
	
	if not root or deb then return end
	
	deb = true
	local Clone = game.ServerStorage.Maps.GrassIsles:Clone()
	Clone.Parent = workspace
	root.Position = Clone.Position
	wait(1)
	deb = false
end)
2 Likes

I tweaked the script for a few lines and the script works! Thanks for help!

1 Like

Anytime! if you have anymore isuses don’t be afraid to make another post!

1 Like

I probably will, since I’m making a Tower Defense game that will probably have some bugs. Next thing you know is I made a post about the Troop placing lol.

1 Like