In my server script I have something that would detect for jump when jump is changed, but it's in a tool so how would I say to delete the part inside the player only when the tool is in the player.
local hum = script.Parent.Parent:FindFirstChild("Humanoid") -- if script.Parent.Parent:FindFirstChild("Humanoid") ~= nil then hum:GetPropertyChangedSignal("Jump"):Connect(function() if hum.Jump == true then if script.Parent.Parent:FindFirstChild("Attachment0Holder") ~= nil then script.Parent.Parent:FindFirstChild("Attachment0Holder"):Destroy() end end end) -- end
the notes is what I want to happen but it doesn't work when I do that
local hum = script.Parent.Parent:FindFirstChild("Humanoid") -- if script.Parent.Parent:FindFirstChild("Humanoid") ~= nil then hum:GetPropertyChangedSignal("Jump"):Connect(function() if hum.Jump == true then if script.Parent.Parent:FindFirstChild("Attachment0Holder") ~= nil then script.Parent.Parent:FindFirstChild("Attachment0Holder"):Destroy() end end end) -- end
Remove the GetPropertyChangedSignal use .Changed instead. example:
Humanoid.Changed:Connect(function(property) if property == "Jump" then print("Jump") end end)
or just take this lol
local hum = script.Parent.Parent:FindFirstChild("Humanoid") -- if script.Parent.Parent:FindFirstChild("Humanoid") ~= nil then hum.Changed:Connect(function(property) if property == "Jump" then if hum.Jump == true then if script.Parent.Parent:FindFirstChild("Attachment0Holder") ~= nil then script.Parent.Parent:FindFirstChild("Attachment0Holder"):Destroy() end end end end) -- end
try doing this:
local hum = script.Parent.Parent:FindFirstChild("Humanoid") if not hum then return end -- if doesn't find humanoid then it will do nothing by returning nothing. hum:GetPropertyChangedSignal("Jump"):Connect(function() if hum.Jump == true then if script.Parent.Parent:FindFirstChild("Attachment0Holder") ~= nil then script.Parent.Parent:FindFirstChild("Attachment0Holder"):Destroy() end end end)