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

Help with variable issue?[Unsolved]

Asked by 9 years ago

Hey guys- Today I am trying to get an objects position and store it within a value that belongs specifically to a player. It sounds easy and it probably is but I just can't figure out why its not working out for me. Here's the local script.

local plyr = game.Players.LocalPlayer.Character
local shipposition = game.Workspace[Shipsname.Value].BodyKit.Grok.Position
    print(shipposition) -- This gives me the correct value
    plyr.Shipsposition.Value = shipposition
    game.Workspace[Shipsname.Value]:Destroy()

When I run the script the shipposition variable works just fine and it prints out the desired position without any errors but if I were to print out the Shipsposition value it would give me 0. I'll be happy to clarify on anything if I can, but thanks! lordrex12345

0
I don't see anything wrong with this script? NotsoPenguin 705 — 9y
0
Yea, I don't see anything wrong with it but when I try to assign the value of shipposition to Shipsposition, it won't work meaning Shipsposition remains as a 0 instead of changing. lordrex12345 25 — 9y
0
Bump, still need some help with this guys. lordrex12345 25 — 9y

1 answer

Log in to vote
-1
Answered by
yumtaste 476 Moderation Voter
9 years ago

If you're trying to print the value of Shipsposition before line 4, it won't work because the value wasn't set.

0
There are two different values referred to as shipposition. NotsoPenguin 705 — 9y
0
I am not trying to print the value of Shipposition, I am trying to assign it... lordrex12345 25 — 9y
Ad

Answer this question