I know this is not a request site but I have a script that takes an object value and uses it for a location (at the bottom). I was wondering if it is physically possible to turn that value of the objectvalue into a string value. My issue is the objectvalue holds a player name but the player name is an objectvalue so I can't use it for finding a location (if this is too confusing just ask for me to explain and I will).
Well here is the code, it is pretty much pointless, you don't even need to look at it:
rewardmessage = game.Lighting.KillerReward script.Parent.Zombie.Died:connect(function() if script.Parent.Zombie.Health == 0 then local killer = script.Parent.Zombie.creator print(killer.Value) local killervalue = Instance.new("BoolValue", script.Parent) killervalue.Value = killer.Value local rewardclone = rewardmessage:clone() rewardclone.Parent = game.Players[killer.Value].PlayerGui.MainScreen if game.Players[killer.Value].PlayerGui.MainScreen.PlayerValues.HasCoinBooster.Value == true then rewardclone.CoinReward.Text = "+2 coins" if game.Players[killer.Value].PlayerGui.MainScreen.PlayerValues.HasXPBooster.Value == true then rewardclone.XPReward.Text = "+10 XP" else rewardclone.XPReward.Text = "+5 XP" end else rewardclone.CoinReward.Text = "+1 coin" if game.Players[killer.Value].PlayerGui.MainScreen.PlayerValues.HasXPBooster.Value == true then rewardclone.XPReward.Text = "+10 XP" else rewardclone.XPReward.Text = "+5 XP" end end end end)
If you want the Name
of an object, you can use the .Name
property, which is a string. (You could also use the :GetFullName()
property to get the full path, which is much more identifying, but using this is hard)
For example, is plr
is a reference to some player, their name is plr.Name
.
We could then get their object again using game.Players[plr.Name]
(plr == game.Players[plr.Name]
)
If we want to get the position of their Torso, we could ask for plr.Character.Torso.Position
.
Or, if you were instead given the name of the player, plrName
, you would just get plr
using game.Players[plrName]
.