I’m parenting and welding a part to each character’s humanoidrootpart to act as a hitbox of sorts with a clickdetector which should print “activated” but for some reason, it doesn’t. The clickdetector works when the hitbox is put in a dummy, but not when inside an actual character. The server script to add the hitbox to the player contains the following:
local ChallengeHitbox = ReplicatedStorage:WaitForChild("PlayerChallengeHitbox")
Players.PlayerAdded:Connect(function(Player)
local PlayerValues = Values:Clone()
PlayerValues.Parent = Player
Player.CharacterAdded:Connect(function(character)
local PlayerChallengeHitbox = ChallengeHitbox:Clone()
PlayerChallengeHitbox.Parent = character
local Weld = Instance.new("WeldConstraint")
Weld.Parent = character.HumanoidRootPart
Weld.Part0 = PlayerChallengeHitbox
Weld.Part1 = character.HumanoidRootPart
PlayerChallengeHitbox.CFrame = character.HumanoidRootPart.CFrame
PlayerChallengeHitbox.Script.Disabled = false
end)
end)
And the script inside of the hitbox simply contains the following:
local ClickDetector = script.Parent.ClickDetector
ClickDetector.MouseClick:Connect(function()
print("activated")
end)
So the server script is supposed to enable the script inside of the hitbox after the hitbox is welded and parented to the player, and as soon as it enabled, the hitbox script should simply allow the game to print a statement when the clickdetector is clicked on. Thanks in advance