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

Model.Parent is workspace instead of another model I parented it to, how do I get the character?

Asked by 4 years ago
Edited 4 years ago

I'm trying to implement a "pet" system where a pet model is parented to the character in the workspace. I'm trying to get the character of the script that is parented to the pet that is parented to the character. However, "Workspace" is printed not player name.

local character = script.Parent.Parent
local pet = script.Parent
local function attack(player, target)
print(character)

Attack function is hooked to a remote event that is fired from a local script. link to image of hierarchy: https://imgur.com/a/dB2GbLU

0
well if the script is inside the character then for character you would just need script.Parent ForeverBrown 356 — 4y
0
script is inside pet which is inside character audyappy 1 — 4y
0
can you post a picture of your hierarchy? (the explorer window) ForeverBrown 356 — 4y

Answer this question