Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script is killing players?

Asked by
FiredDusk 1466 Moderation Voter
9 years ago

This is kinda killing players when they touch the part.

part = script.Parent

function Touched (char)
    char.Position = Vector3.new(10,10,10)

end

script.Parent.Touched:connect(Touched)

5 answers

Log in to vote
2
Answered by 9 years ago

Try Using the moveto function:

part = script.Parent
cords = 10, 10, 10 -- put cords here
local Human = char.Parent:FindFirstChild("Humanoid")

    local Player = char.Parent
function Touched (char)

    Player:MoveTo(Vector3.new(cords))

end

script.Parent.Touched:connect(Touched)

Hope i help!

0
Does not work FiredDusk 1466 — 9y
0
I fixed it though. Thanks :) FiredDusk 1466 — 9y
0
There i fixed forgot to include a line. pluginfactory 463 — 9y
0
No problem glad i could help :D pluginfactory 463 — 9y
View all comments (4 more)
0
I fixed YOUR script. You did it wrong, you needed the variables in the function FiredDusk 1466 — 9y
0
oh, ok i made a mistake, but again, glad i could help :D pluginfactory 463 — 9y
0
*stuffs phone cord in variable* What? It said cords! D:< TerrodactyI 173 — 9y
0
0.o That might work... pluginfactory 463 — 9y
Ad
Log in to vote
1
Answered by 9 years ago

Please accept this answer:

It may have to do with humanoid that you got.

0
I'll just give you an upvote. FiredDusk 1466 — 9y
0
Well, Anything is fine. Thanks a lot :). May you please answer my questions because you are awesome. SeptorHD 15 — 9y
0
Omg so old! FiredDusk 1466 — 8y
Log in to vote
0
Answered by 9 years ago

What part of the character are you moving? I would use CFrame on the Torso. That will tp the player to anywhere you want without killing them in the process.

0
Make the script for me please. FiredDusk 1466 — 9y
Log in to vote
0
Answered by
lucas4114 607 Moderation Voter
9 years ago

Use :MoveTo()

part = script.Parent

function Touched (char)
    char:MoveTo(10,10,10)

end

script.Parent.Touched:connect(Touched)
0
16:59:42.594 - MoveTo is not a valid member of Part Thats the error FiredDusk 1466 — 9y
0
MoveTo Is only for models. pluginfactory 463 — 9y
Log in to vote
0
Answered by 9 years ago

Unfortunately the method you used to move the character unfortunately moved the character's limbs using the Position property, breaking all joints and killing the player's character.

local coords = CFrame.new(0,10,0)

script.Parent.Touched:connect(function(hit)
    if hit then
        if hit.Parent then
            if hit.Parent:FindFirstChild('Humanoid') then
                if hit.Parent.Humanoid.Torso then
                    hit.Parent.Humanoid.Torso.CFrame = coords
                end
            end
        end
    end
end)

The above code is meant to teleport a player to the specified coordinates without unexpectedly teleporting them on top of a building if you wanted to teleport them inside. That's the problem with MoveTo() and Position.

I hope you find my answer helpful, I live to help (not really).

Answer this question