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

help with fixing a code involving teleportation?

Asked by 3 years ago

this code is not throwing up errors and in theory (in my head) it should work i honestly don't know what to do any help?

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
    local CharacterModel = player.Character 

    CharacterModel:SetPrimaryPartCFrame(CFrame.new(1, 0, 1) * CFrame.Angles(math.rad(0), math.rad(80), math.rad(0)))
    wait(1)
  end)
end)

3 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

Seems good, the only wrong i see is local CharacterModel = player.Character That should be local CharacterModel = player.character So try that. Because you did player.Character.Added:Connect(function(character) so it's character not Character.

0
i tried this but it still did not work yoursoulsaver 5 — 3y
0
Ur wrong its player.Character or character the latter is the parameter VerdommeMan 1479 — 3y
Ad
Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
3 years ago

Hello ,while I don't really know what's wrong with it here try this out it might work:

game.Players.PlayerAdded:Connect(function(p)        
    p.CharacterAdded:Connect(function(char) 
            local CF = CFrame.new(1, 0, 1) * CFrame.Angles(math.rad(0), math.rad(80), math.rad(0))
            char.HumanoidRootPart.CFrame = (CF)
            wait(1)
    end)
end)
0
this does nto work either but maybe because i put it in the wrong place? right now it is in the workspace yoursoulsaver 5 — 3y
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

this is a script right? Use then the GetService for the players like this, i have to many times an event not fire bc someone didnt use the service and the playerloaded faster in than the event got connected

local players = game:GetService("Players")

players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
    -- why save the character in a temp variable when u already have it as a parameter ?????
    -- its better than you change the CFrame of the HRT
    character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(1, 0, 1) * CFrame.Angles(math.rad(0), math.rad(80), math.rad(0)) -- i am not sure if you know what this actually does
   -- no wait needed literally serves no purpose
  end)
end)
0
unfortantly this did not work for me, does it work in your world? and yes i do know what it does it is supposed to relocate the player and turn them so they are facing a certain direction. the reason why is long if you want me to explain i can. thank you for your help :) yoursoulsaver 5 — 3y

Answer this question