READ EDIT AT BOTTOM
Hello! I am here to help. Usually, for teleport scripts, I use .Position, since whenever I use CFrame, it always returns an error about CFrame not existing, and I'm not sure why. Anyways, that is my recommendation. In addition, you would use a new Vector3 instead of making a new CFrame. Let me show you an example of what I use for teleport scripts.
local teleport = game.Workspace.TeleportDestination
local part = script.Parent
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildWhichIsA("Humanoid") then
hit.Parent.Humanoid.Position = Vector3.new(teleport.Position.X, teleport.Position.Y + 5, teleport.Position.Z)
print('Success')
end
end)
Before using the script, make sure the spawn point is anchored. (it should be by default)
Hope this helps!
EDIT:
So after looking at your question again and the script, I realized you did:
script.Parent.Touched:Connect(function(plr)
Note that the .Touched event does not pass through the player arguement.
Instead, it passes through the bodypart/part that touched the part.
In this case, it would pass through probably the player's leg(s) as the bodypart.
This would mean the parent would be the player's character.
Therefore, do:
script.Parent.Touched:Connect(function(part)
local character = part.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
end)
Again, hope this helps!
13 comments
Hi thanks for helping but again it still doesn't teleport and it comes out with no errors. I don't know if it's a glitch or what but I have taken tutorials and still nothing happens.
@aydenwilson819 It works for me. When I tried your code, I don''t know how you didn't get an error because it errors for me.
@aydenwilson819 Screenshot your Output window to me. I feel like you don't know the output because you''d have got an error with your code.
Here is the link to the screenshot: file:///C:/Users/hyper/Videos/Captures/Untitled%20Game%20-%20Roblox%20Studio%209_16_2021%205_26_16%20PM.png
@aydenwilson819 Well, apparently I'm not on your computer. Post the image on gyazo.com . Also that's not a link that's the path to your screnshots in your files.
https://gyazo.com/a5f52563f8141f4b959e640ffbb09ce9
@aydenwilson819 Can you expand your output? I only saw a little bit show me your entire output not just a little bit
Sure here you go: https://gyazo.com/3e134d39bc29eab826880ce058f8e793
Show me the first line in your output.
The first line in the output just says that the game was saved.
@aydenwilson819 Make sure it's a script and not a LocalScript.
Thank you! It worked! It was a long 4 day process so I would like to thank you for helping all the way through
Oof, I didn't realize that you used a Script.