--// SERVICES
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local RunService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
--// CLIENT
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local tool = script.Parent
local CD = false
local rushanim = humanoid:LoadAnimation(script.Parent.Animations.Charge)
--// INPUT
userInputService.InputBegan:connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.One and character:FindFirstChild("Stunned") == nil then
rushanim:Play()
rushanim:AdjustSpeed(0.5)
script.Parent.Events.activate:FireServer(character)
wait(0.5)
rushanim:AdjustSpeed(0)
wait(0.15)
rushanim:AdjustSpeed(1)
wait(0.3)
rushanim:AdjustSpeed(0)
end
end)
This is the first localscript
local wrath = script.Parent.Parent.Events:WaitForChild("activate")
wrath.OnServerEvent:connect(function(player, character)
game.ReplicatedStorage.ClientEffects.Events.Skills.wrathvfx:FireAllClients(character)
end)
Then the script that fires to all clients
local showtime = game.ReplicatedStorage.ClientEffects.Events.Skills.wrathvfx
local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")
showtime.OnClientEvent:connect(function(player, character)
local particle = script.Parent.BrolyRush:Clone()
particle.Enabled = false
particle.Parent = player.HumanoidRootPart
particle.Enabled = true
wait(0.65)
local dashvfx = game.ReplicatedStorage.ClientEffects.VisualEffects.DashTrail:Clone()
dashvfx.Parent = game.Workspace.Effects
dashvfx.CFrame = player.HumanoidRootPart.CFrame * CFrame.Angles(0,89.2,0)
local tweeninginfo = TweenInfo.new(0.65, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local partProperties =
{
Transparency = 1,
Size = Vector3.new(18,18,18)
}
local Tween = TweenService:Create(dashvfx,tweeninginfo,partProperties)
Tween:Play()
end)
But it never replicates on the other clients, why?
When doing :FireAllClients(), you are only sending a single argument. The player argument is actually the character, and the character argument is always going to be nil. Below is the fixed script.
local wrath = script.Parent.Parent.Events:WaitForChild("activate")
wrath.OnServerEvent:connect(function(player, character)
game.ReplicatedStorage.ClientEffects.Events.Skills.wrathvfx:FireAllClients(player,character)
end)
You CANT fire clients using the Local Script, you must use a Script to do it.Script used function FireClient() and FireAllClients() and Local Script used function FireServer().
I have a tip to fix a script my self, you can use a print("Passed") every line you passed and look for the line it disconnected. This will be an example :
local frame = script.Parent
local button = script.Parent.Button
button.MouseButton1Click:Connect(function()
print("Passed") -- It printed right here
if frame.Visible == false then
print("Passed") -- This is not printing to the output, take a look at the line we just passed... Oh, instead of frame.Visible == true I wrote wrong to frame.Visible == false, fix it and it worked!
frame.Visible = false
end
end)