Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Teleport a player when they kill a monster... Any help?

I'm trying to make a script where when player kills a the monster, they'll get teleported. Confused by my own script though. Here's my script:

local Humanoid = script.Parent.Humanoid
function Teleport()
local tag = Humanoid:FindFirstChild("creator")
if tag ~= nil then
	if tag.Value ~= nil then
		local p = game.Players:GetPlayerFromCharacter("tag.Value")
		p.Character.Humanoid.Torso.CFrame = script.Parent.TeleOut.CFrame
		wait(0.1)
		script:remove()
	end
end
end
Humanoid.Died:connect (Teleport)

After they killed the monster, they'll get teleported to where "TeleOut" is.

2 comments

0

Could you explain what you need help with? Is your script doing something weird?

0

After I killed the monster, it's not teleporting me to where "TeleOut" is

1 answer

There are somethings to fix Some of these are mistakes some people can sometimes not notice

local Humanoid = script.Parent.Humanoid
function Teleport()
local tag = Humanoid:WaitForChild("creator")
if tag ~= nil then
    if tag.Value ~= nil then
        local p = game.Players:GetPlayerFromCharacter(tag.Value)
        p.Character.Humanoid.Torso.CFrame =   p.Character.Humanoid.Torso.CFrame.new([where you want]) -- In where you want you should put in the XYZ values
        wait(0.1)
        script:Remove()
    end
end
end
Humanoid.Died:Connect(Teleport) --Connect is depricated

Hopefully this helped you :)

1 comment

0

nope dont work

This discussion is preserved as it was. New answers, comments, and votes are closed.