#Function returns none

1 messages · Page 1 of 1 (latest)

proud steppe
#
    set {_block} to block at {_p}
    set {_loc} to location of {_block}
    broadcast {_block},{_loc}
    broadcast "%newLocationWithPlayerRotation({_loc}, {_p})%" #<- returns none???
    teleport {_p} to newLocationWithPlayerRotation({_loc}, {_p})
    
function combineLocationwithRotation(location: location, yaw: number, pitch: number) ::location:
    set {_x} to x of {_location}
    set {_y} to y of {_location}
    set {_z} to z of {_location}
    set {_world} to world of {_location}
    broadcast {_x},{_y},{_z},{_world}
    set {_location} to location({_x},{_y},{_z},world "%{_world}%",{_yaw},{_pitch})
    return {_location}
    
function newLocationWithPlayerRotation(location: location, p: player) :: location:
    set {_yaw} to yaw of {_p}
    set {_pitch} to pitch of {_p}
    return combineLocationwithRotation({_location}, {_yaw}, {_pitch})```
For context, I'm trying to center the player using the function centerPlayer() but the function is only broadcasting {_loc},{_block} and world when called and the function's result is none
gilded inlet
#

i think you're overcomplicating this a bit

#

literally something as simple as this should work

set {_l}'s yaw to player's yaw
set {_l}'s pitch to player's pitch
teleport player to {_l}```
boreal cypress
#

also the problem was that x of __ is for vectors, x coord of __ is for locations