hello guys, so my goal is to make the highlight change colors/transparency when an attachment is found in the humanoidrootpart and changes back when its not found (it should only work if a certain attachment is found). i tried something but its kinda weird since i suck at scripting but here is what i tried (it doesnt work)
local script (in attachment)
local player = game.Players.LocalPlayer
local char = player.Character
local root = char:WaitForChild("HumanoidRootPart")
local rs = game.ReplicatedStorage
local fillTransparency = 0.5
local fillColor = Color3.fromRGB(9, 70, 0)
local outlineColor = Color3.fromRGB(9, 70, 0)
local outlineTransparency = 0
root.Changed:Connect(function(player, fillTransparency, fillColor, outlineColor, outlineTransparency)
rs.Remotes.HighlightChange:FireServer(fillTransparency, fillColor, outlineColor, outlineTransparency)
end)
server script (in serverscriptservice)
local rs = game.ReplicatedStorage
local highlight = game.ReplicatedStorage.Highlight:Clone()
--game.Players.PlayerAdded:Connect(function(player)
--player.CharacterAdded:Connect(function(char)
--highlight.Parent = char --this part just spawns the highlight upon joining
--highlight.FillTransparency = 1
--highlight.OutlineTransparency = 1
--end)
--end)
rs.Remotes.HighlightChange.OnServerEvent:Connect(function(player, fillTransparency, fillColor, outlineColor, outlineTransparency)
print(player..fillTransparency..fillColor..outlineColor..outlineTransparency)
if player.Character:WaitForChild("HumanoidRootPart"):FindFirstChild("Aura") then --"Aura" is the attachment im talking about
highlight.FillTransparency = fillTransparency
highlight.OutlineTransparency = outlineTransparency
highlight.FillColor = fillColor
highlight.OutlineColor = outlineColor
else
highlight.FillTransparency = 1
highlight.OutlineTransparency = 1
end
end)
i dont get any errors so idk what im doing wrong, but thanks for any help.