Hello, my problem is the following, I’m wanting the enemy to be marked after hitting the skill on him, but it’s not working, I’ve tried everything… If anyone can help me with this, I’d really appreciate it!
My script is this:
script.Parent.OnServerEvent:Connect(function(plr,direction,mouseaim)
local OnHit = false
local Alive = true
local SizeOni = UDim2.new(0,200 , 0,50)
local EZ = plr.Character:WaitForChild("HumanoidRootPart")
local Goro1 = game.ReplicatedStorage.Goro.Goro1:Clone()
Goro1.Parent = workspace
Goro1.CanCollide = false
Goro1.Anchored = false
plr.Character.RightHand.EFHandC:Destroy()
Goro1.CFrame = CFrame.new((plr.Character.RightHand.CFrame * CFrame.new(0,0,-2)).p,direction.p)
Goro1.Orientation = Goro1.Orientation + Vector3.new(0,0,0)
Goro1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Name ~= plr.Name and not hit.Parent:FindFirstChild("AlreadyHit") then
local An = Instance.new("Animation")
An.Parent = hit.Parent.Humanoid
An.Name = plr.Name
local Explosion = game.ReplicatedStorage.Goro.Explosion:Clone()
Explosion.Parent = workspace
local Sound = game.ReplicatedStorage.Goro.eXplosion:Clone()
Sound.Parent = Explosion
Sound:Play()
Explosion.CFrame = hit.Parent.HumanoidRootPart.CFrame * CFrame.new(0,0,0)
local Check = Instance.new("IntValue", hit.Parent)
Check.Name = "AlreadyHit"
game.Debris:AddItem(Check ,3)
local VCharacter = game.Workspace:FindFirstChild(plr.Name)
local vPlayer = game.Players:GetPlayerFromCharacter(VCharacter)
local Humanoid = hit.Parent:WaitForChild("Humanoid")
TagHumanoid(Humanoid,vPlayer)
hit.Parent.Humanoid:TakeDamage(10 * (1+plr.Data.Special.Value*1))
ShareExp(Humanoid, plr)
wait(0.5)
An:Destroy()
UntagHumanoid(Humanoid)
wait(1.7)
Sound:Destroy()
wait(1)
Goro1:Destroy()
Explosion:Destroy()
end
end)
local BV = Instance.new("BodyVelocity",Goro1)
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity = CFrame.new(EZ.Position,mouseaim).LookVector * 100
wait(5)
Goro1:Destroy()
end)
function ShareExp(humanoid, player)
if not humanoid.Parent.HittedPlayers:FindFirstChild(player.Name) then
local a = Instance.new("StringValue")
a.Value = player.Name
a.Name = player.Name
a.Parent = humanoid.Parent.HittedPlayers
end
end
function TagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end