What do you mean? You should just be able to set the Adornee to the player’s character (I put an example below).
What is “ObjectValue”? Try printing it out and seeing what it is.
Edit: Nevermind, do ObjectValue.Value
to access the value of the ObjectValue.
This part of the script
local currentTagged = Instance.new("ObjectValue")
currentTagged.Name = "CURRENT TAGGED PLAYER"
currentTagged.Parent = rs
Yeah, so assuming you set the value of ObjectValue like this:
currentTagged.Value = -- the object
Then you should be able to do this:
currentTagged.Value -- this will return the object
If you store the player from game.Players
, you would have to do currentTagged.Value.Character
.
If you store the character, you would just have to do currentTagged.Value
.
Soooo
if currentTagged.Value then
local hl = script.Highlight
hl.Adornee = currentTagged.Value.Character
end
Like this?
Yes, if you store the player from game.Players
.
Because you’re not putting it outside of the while loop. Put it outside every if/while/etc.
Also, I recommend using the .Changed event:
currentTagged.Changed:Connect(handleHighlight);
Also, you may need to store the highlight somewhere the player can access it, as the player is unable to access things in ServerScriptService, so they may not be able to see it on the client.
Perhaps store the highlight in ReplicatedStorage.
You are storing the character, so you don’t need .Character
. Just use currentTagged.Value
.
Oh my, it works, thank you so much man, you are a lifesaver
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.