Local Script Inside Character Starter Scripts:
game.ReplicatedStorage.remotes.Abilities.OnClientEvent:Connect(function(Ability)
local Player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
local Connect
local Character = Player.Character
Connect = UIS.InputBegan:Connect(function(MS, gameProcessed)
if MS.UserInputType == Enum.UserInputType.MouseButton1 or MS.UserInputType == Enum.UserInputType.Touch then
if gameProcessed then
Connect:Disconnect()
return end
if Mouse.Target.Parent:FindFirstChild("Humanoid") then
if (Mouse.Target.Parent:WaitForChild("HumanoidRootPart").Position - Character:WaitForChild("HumanoidRootPart").Position).Magnitude < 30 then
if Mouse.Target.Parent:WaitForChild("Ragdoll").Value == true then Connect:Disconnect() return end
local Target = Mouse.Target.Parent
game.ReplicatedStorage.remotes.Abilities:FireServer(Ability, Target)
Connect:Disconnect()
end
else
if Mouse.Target.Parent.Parent:FindFirstChild("Humanoid") then
if (Mouse.Target.Parent.Parent:WaitForChild("HumanoidRootPart").Position - Character:WaitForChild("HumanoidRootPart").Position).Magnitude < 30 then
if Mouse.Target.Parent.Parent:WaitForChild("Ragdoll").Value == true then Connect:Disconnect() return end
local Target = Mouse.Target.Parent.Parent
game.ReplicatedStorage.remotes.Abilities:FireServer(Ability, Target)
Connect:Disconnect()
end
end
Connect:Disconnect()
end
end
end)
end)
ServerScript, Inside ServerScriptService:
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("TargetTypeSpells").Enabled = true
local TargetSpells = require(script.TargetSpellsM)
Player.Chatted:Connect(function(Word)
Word = string.lower(Word)
if Word == string.lower("Phesmatos Ossox") then
game.ReplicatedStorage.remotes.Abilities:FireClient(Player, "Phesmatos Ossox")
end
end)
task.spawn(function()
game.ReplicatedStorage.remotes.Abilities.OnServerEvent:Connect(function(Player, Ability, Target)
if Ability == "Phesmatos Ossox" then
if Player:FindFirstChild("PhesmatosOssoxCooldown") then
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "Notification", "Phesmatos Ossox is on Cooldown for "..Player:FindFirstChild("OssoxCooldown").Value.." more seconds.")
return end
TargetSpells.PhesmatosOssox(Player, Target)
local Cooldown = Instance.new("NumberValue", Player)
Cooldown.Name = "PhesmatosOssoxCooldown"
Cooldown.Value = 10
task.spawn(function()
while Cooldown.Value > 0 do
task.wait(1)
Cooldown.Value = Cooldown.Value - 1
end
Cooldown:Destroy()
end)
end
end)
end)
end)
end)
ModuleScript, Parent to The ServerScript
local TargetSpells = {}
function TargetSpells.PhesmatosOssox(Player, Target)
local Character = Player.Character
local TweenService = game:GetService("TweenService")
Target:WaitForChild("Humanoid").WalkSpeed = 0
Character:WaitForChild("Humanoid").WalkSpeed = 0
TweenService:Create(Character.HumanoidRootPart, TweenInfo.new(.15), {CFrame = CFrame.lookAt(Character.HumanoidRootPart.Position, Target.UpperTorso.Position)}):Play()
TweenService:Create(Target.HumanoidRootPart, TweenInfo.new(.15), {CFrame = CFrame.lookAt(Target.HumanoidRootPart.Position, Character.UpperTorso.Position)}):Play()
task.wait(.15)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "Blur", 5, 6.69, 0)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraEffect", Vector3.new(-2,-2,0), 0.33)
local TAnimation = Instance.new("Animation")
TAnimation.AnimationId = "rbxassetid://109168910715142"
Target:WaitForChild("Humanoid").Animator:LoadAnimation(TAnimation):Play()
task.wait(0.33)
Target:WaitForChild("Humanoid"):TakeDamage(20)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraShake")
task.spawn(function()
local SFX = Instance.new("Sound", Target:WaitForChild("Head"))
SFX.SoundId = "rbxassetid://9113542363"
SFX.Volume = 1.5
SFX:Play()
task.wait(SFX.TimeLength)
SFX:Destroy()
end)
task.spawn(function()
local SFX = Instance.new("Sound", Character:WaitForChild("Head"))
SFX.SoundId = "rbxassetid://12708139748"
SFX.Volume = 1.25
SFX:Play()
task.wait(SFX.TimeLength)
SFX:Destroy()
end)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "DamageAreaEffect", Color3.new(0, 0, 0), 0.35, 0.65)
task.wait(1.67)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraEffect", Vector3.new(2,2,0), 0.33)
task.wait(0.33)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraShake")
Target:WaitForChild("Humanoid"):TakeDamage(20)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "DamageAreaEffect", Color3.new(0, 0, 0), 0.35, 0.65)
task.spawn(function()
local SFX = Instance.new("Sound", Target:WaitForChild("Head"))
SFX.SoundId = "rbxassetid://100667107067966"
SFX.Volume = 1.25
SFX:Play()
task.wait(SFX.TimeLength)
SFX:Destroy()
end)
task.spawn(function()
local SFX = Instance.new("Sound", Character:WaitForChild("Head"))
SFX.SoundId = "rbxassetid://12708139748"
SFX.Volume = 1.25
SFX:Play()
task.wait(SFX.TimeLength)
SFX:Destroy()
end)
task.wait(2.37)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraEffect", Vector3.new(0,6,0), 1.99)
local SFX2 = Instance.new("Sound", Target:WaitForChild("Head"))
SFX2.Volume = 2.25
SFX2.SoundId = "rbxassetid://143501865"
SFX2:Play()
task.wait(1.69)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraEffect", Vector3.new(-3.5,4,-1), 0.3)
wait(0.3)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraShake")
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraShake")
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "CameraShake")
Target.Ragdoll.Value = true
task.spawn(function()
local SFX = Instance.new("Sound", Target:WaitForChild("Head"))
SFX.SoundId = "rbxassetid://9113542363"
SFX.Volume = 4
SFX:Play()
task.wait(SFX.TimeLength)
SFX:Destroy()
end)
game.ReplicatedStorage.remotes.SFX:FireClient(Player, "DamageAreaEffect", Color3.new(0, 0, 0), 0.35, 0.65)
Target:WaitForChild("Humanoid").Health = Target:WaitForChild("Humanoid").Health - Target:WaitForChild("Humanoid").Health
Target:WaitForChild("Humanoid").WalkSpeed = 16
Character:WaitForChild("Humanoid").WalkSpeed = 16
TAnimation:Destroy()
TweenService:Create(SFX2, TweenInfo.new(1, Enum.EasingStyle.Sine), {Volume = 0}):Play()
wait(1)
SFX2:Destroy()
end
return TargetSpells
I dont know why this script executes twice, or sometimes three times when theres multiple players ingame, Im so confused on how to fix it, If anyone could help that would be amazing, The local script is disabled until a character spawns then it enables inside that character.