Hey !
Alright, so i’m doing a system with a remote event to do a dash.
All arguments are given from a local script, to a script (with a remote event) and then to a module.
The problem is, the “Cooldown” value isn’t finded by the script, like it think that the value is in the humanoidRootPart, but it isn’t…
local script code
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Character = game.Workspace:WaitForChild(Player.Name ,5)
local Events = game.ReplicatedStorage:WaitForChild("Events" ,5)
local Gui = Player:WaitForChild("PlayerGui" ,5)
local Cooldown = Player:WaitForChild("Cooldown" ,5)
if Events ~= nil and Gui ~= nil and Character ~= nil and Cooldown ~= nil then
local DashEvent = Events:WaitForChild("Dash" ,5)
local DashCooldown = Cooldown:WaitForChild("Dash" ,5)
local Toolbar = Gui:WaitForChild("Toolbar" ,5)
local Humanoid = Character:WaitForChild("Humanoid" ,5)
local Root = Character:WaitForChild("HumanoidRootPart" ,5)
if DashEvent ~= nil and Toolbar ~= nil and Humanoid ~= nil and Root ~= nil and DashCooldown ~= nil then
local DashButton = Toolbar:WaitForChild("Dash" ,5)
local Animator = Humanoid:WaitForChild("Animator" ,5)
if DashButton ~= nil and Animator ~= nil then
local function DashUpdate()
DashEvent:FireServer(Player, Animator, Root, DashCooldown)
end
UIS.InputBegan:Connect(function(key, processed)
if key.UserInputType == Enum.UserInputType.Keyboard then
if key.KeyCode == Enum.KeyCode.Space then
DashUpdate()
end
end
end)
DashButton.MouseButton1Click:Connect(function()
DashUpdate()
end)
end
end
end
Script code
local Events = game.ReplicatedStorage:WaitForChild("Events" ,5)
if Events ~= nil then
local AttackEvent = Events:WaitForChild("Attack" ,5)
local AbilityEvent = Events:WaitForChild("Ability" ,5)
local DashEvent = Events:WaitForChild("Dash" ,5)
if AttackEvent ~= nil and AbilityEvent ~= nil and DashEvent ~= nil then
DashEvent.OnServerEvent:Connect(function(Player, Animator, Root, DashCooldown)
if DashCooldown.Value <= 0 then
local Module = script:FindFirstChild("Dash")
if Module ~= nil then
local Function = require(Module)
Function.Dashing(Player, Animator, Root, DashCooldown)
end
end
end)
end
end