So when I play the game and touch the part that should Fire the Remote Event nothing happens and there is no problems or anything in the output. I'm not sure what is happening, I tried searching but still no solution
-- Server Script script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then game:GetService("ReplicatedStorage"):FindFirstChild("DestroyArrow"):FireClient(game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)) end end) -- ================================================================ -- Local Script game:GetService("ReplicatedStorage"):FindFirstChild("DestroyArrow").OnClientEvent:Connect(function() script.Parent:Destroy() game.Workspace.Spawn.Arrow:Destroy() print("Done") end)
Edit: You're destroying the script before you do what the RemoteEvent is intended to do, I would destroy the script's parent when complete. I use assertions, they return errors if they fail. If you find it in the output don't worry about it.
You should use the methods that Roblox has provided in their API Reference.
------------------- --[[ Server Script ]] local Players: Players = game:GetService("Players") local ReplicatedStorage: ReplicatedStorage = game:GetService("ReplicatedStorage"); local RemoteEvent: RemoteEvent = ReplicatedStorage:WaitForChild("DestroyArrow"); script:FindFirstAncestorWhichIsA("BasePart").Touched:Connect(function(BasePart: BasePart) local Character: Model = BasePart:FindFirstAncestorWhichIsA("Model"); assert(Character); local Humanoid: Humanoid = Character:FindFirstChildWhichIsA("Humanoid"); assert(Humanoid); local Player: Player = Players:GetPlayerFromCharacter(Character); assert(Player); return RemoteEvent:FireClient(Player); end) ------------------- --[[ LocalScript ]] local ReplicatedStorage: ReplicatedStorage = game:GetService("ReplicatedStorage"); local RemoteEvent: RemoteEvent = ReplicatedStorage:WaitForChild("DestroyArrow"); RemoteEvent.OnClientEvent:Connect(function() workspace:WaitForChild("Spawn", math.huge):WaitForChild("Arrow", math.huge):Destroy() script:Destroy() end)