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

CFrame touched not working "player.leaderstats.Stage.Value" part never works.. (?)

Asked by 4 years ago
Edited 4 years ago
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
wait(0.1)
script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        hit.Parent.HumanoidRootPart.CFrame = game.Workspace:FindFirstChild(player.leaderstats.Stage.Value).CC.CFrame
    end
end)

i can't manage to get the actual value of the stage it says that you're on. Instead i currently have it like this for example:

game.Workspace:FindFirstChild("0").CC.CFrame

Please help in any way possible, ty for ur time!

0
what error are you getting? starmaq 1290 — 4y
0
no error at all.. :/ popu2004 42 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
wait(0.1)
script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        hit.Parent.HumanoidRootPart.CFrame = game.Workspace:FindFirstChild(player.leaderstats.Stage.Value).CC.Position
    end
end)

try this

0
doesn't work guess ill just have to stick to my shitty one :( popu2004 42 — 4y
0
23:24:08.120 - Workspace.Stage 1.Part.Script:8: 'end' expected (to close 'function' at line 2) near '<eof>' popu2004 42 — 4y
0
nvm fixed the error but still doesnt work, im actually getting really confused on why this isnt working, its supposed to be easy :( popu2004 42 — 4y
0
No, you should try deleting the player entering script and the characteradded. TinfoilbotGamer 35 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Try this, the problem could be that your stage value is a number and not a string.

game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
wait(0.1)
script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        hit.Parent.HumanoidRootPart.CFrame = game.Workspace:FindFirstChild(tostring(player.leaderstats.Stage.Value)).CC.CFrame
    end
end)

Now if the player is on stage 1 they'll be teleported to a model or part named "1", but you can of course change this if you want.

0
this makes every single player that dies teleport to the stage im on.. pls add my disc Fuze#4779 popu2004 42 — 4y
Log in to vote
0
Answered by 4 years ago

Why not just use a teleport instead of CFrame? It would be much easier to do especially with.Touched!

Answer this question