I made a hook projectile, and when it attaches to something it parents to your character and is named your username, to get rid of it when it is in your attached state you press “R” and it finds the part in your character and deletes it. works fine alone but it multiplayer it does not work.
script:
local event = script.Parent.RPressed
local replicatedStorage = game:GetService("ReplicatedStorage")
event.OnServerEvent:Connect(function(Player,Action)
local Folder = Player:WaitForChild("NumberOfHooks")
local IntValue = Folder:WaitForChild("Amount")
if IntValue.Value == 1 then
if Action == "R" then
local Hook = Player.Character:FindFirstChild(Player.Name)
Hook:Destroy()
local Folder = Player:WaitForChild("NumberOfHooks")
local IntValue = Folder:WaitForChild("Amount")
IntValue.Value = IntValue.Value - 1
end
end
end)