Explanation
Okay, when I ask Is it possible to detect if a part was touched once; I mean… if a part is touched once, it fires an event and doesn’t continue to detect anything touching the part.
A good example: if I was to press the button E, and have an animation play with it moving a stick, it only detects what the stick is touching while the animation is playing.
Code
The animation currently plays on the client side; I plan to update that once I figure out how to get the stick to only detect once.
This code is in a normal Script in ServerScriptService.
game.ReplicatedStorage.Events.MovementListener.OnServerEvent:Connect(function(plr,Fire)
if game.Workspace:FindFirstChild(plr.Name) then
local Character = game.Workspace[plr.Name]
local Module = require(game.ReplicatedStorage.ModuleScript)
if string.lower(Fire) == "pokecheck" then
warn("Fired PokeCheck")
Character.Handle.Hitbox.Touched:Connect(function(hit)
local Table2Print = {hit.Parent.Name,hit.Name}
warn(Table2Print)
if hit.Parent.Name ~= Character.Name and hit.Name == "gamePuck" and hit:FindFirstChild("WeldConstraint") and hit.WeldConstraint.Enabled == true then
hit.WeldConstraint.Enabled = false
hit.WeldConstraint:Destroy()
wait(.02)
game.ServerScriptService.ServerScripts["Hockey.Handler"].Configuration.HasPuck = nil
end
Module.ClearAnimations(Character.Humanoid)
end)
end
end
end)
Thank you in advance for any help you may offer.