player have a tool, when the tool is activated it will fire an event in replicate storage, then connect to servers
which will clone the model from replicatedstorage.folderDmg to workspace.dmgfromRs
I want to make the hitbox/part of the model fired by the player not affect the player character, but only affect the npc that has the humanoid in workspace.npcFolder
ive tried using GetPlayerFromCharacter, but it seems didnt working
local part = script.Parent --
local Debounce = false --(Cooldown)
part.Touched:Connect(function(OtherPart)
if Debounce == false then
Debounce = true --Cooldown
local FindPlayerChar = OtherPart.Parent
local GettingPlayer = game.Players:GetPlayerFromCharacter(FindPlayerChar)
if GettingPlayer then
local Player = GettingPlayer
local Character = GettingPlayer.Character or GettingPlayer.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if Humanoid then
Humanoid:TakeDamage(1)
end
end
print("Almost End!")
task.wait(3)
Debounce = false
end --Debounce
end)