#I have an error and dont know how to fix that
1 messages · Page 1 of 1 (latest)
?
Ich have 3 script. 1:client combat
please send the code
Alr
I have 3 script should I Send all
client combat is exploitable make a server debounce
The Error Said request module experienced an Error while loading
mght be ur wifi]
fr
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserinputService = game:GetService("UserInputService")
local CombatRemote = ReplicatedStorage.Remotes.CombatRemotes
local ClientAnimator = ReplicatedStorage.Remotes.ClientAnimator
local Replicator = ReplicatedStorage.Remotes.Replicator
local attackCooldown = false
local Animation = ReplicatedStorage.Animations
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local tracks = {}
for i = 1,4 do
local a = Animation:FindFirstChild("M"..i)
tracks[i] = character:WaitForChild("Humanoid"):LoadAnimation(a)
end
UserinputService.InputBegan:Connect(function(input,gp)
if gp then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 and attackCooldown == false then
attackCooldown = true
task.delay(.5,function()
attackCooldown = false
end)
CombatRemote:FireServer()
end
end)
ClientAnimator.OnClientEvent:Connect(function(combo)
local t = tracks[combo]
if t then t:play() end
end)
Replicator.OnClientEvent:Connect(function(hrp:Part)
local VFX = game.ReplicatedStorage.VFX.HitVFX.Attachment:Clone()
VFX.Parent = hrp
game.Debris:AddItem(VFX,2)
for i,v in VFX:GetChildren() do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
end)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local attackEvent = game.ReplicatedStorage.Remotes.CombatRemotes
local ClientEvent = game.ReplicatedStorage.Remotes.ClientAnimator
local CombatModule = require(game.ServerScriptService.Modules.CombatModule)
local combats = {}
Players.PlayerAdded:Connect(function(player: Player)
combats[player] = CombatModule.new(player)
end)
Players.PlayerRemoving:Connect(function(player)
combats[player] = nil
end)
attackEvent.OnServerEvent:Connect(function(player)
local combatPlayer = combats[player]
if combatPlayer then
combatPlayer:Attack()
ClientEvent:FireClient(player,combatPlayer.combo)
end
end)
i have 1 more script but its too long to send
i have good wifi
** You are now Level 1! **
i have one more script but its too long to send
the module im guessing?
no sorry
how sould i send the scipt then
** You are now Level 2! **
but check to see if your module does return a value
how
upload as txt
see the plus?
yes the plus
click on that
then it says upload as message file
yes
u need ot haeve smth typed
local Combat = {}
Combat.__index = Combat
local ZoneModule = require(game.ServerScriptService.Modules.Zone)
function Combat.new(player:Player)
local self = setmetatable({}, Combat)
self.player = player
self.character = player.Character or player.CharacterAdded:Wait()
self.hrp = self.character:WaitForChild("HumanoidRootPart")
self.combo = 0
self.busy = false
self.lastAttacktime = 0
self.HitCD = {}
self.HitboxDelay = .35
self.idleTimeout = 1.5
return self
end
function Combat:Attack()
if self.busy == true then return end
self.busy = true
local now = tick()
if now - 0 > self.idleTimeout then
self.combo = 0
end
self.combo = self.combo + 1
if self.combo > 4 then
self.combo = 1
end
print("punched")
task.delay(self.HitboxDelay,function()
local hitbox = Instance.new("Part")
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = .6
hitbox.CastShadow = false
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.Massless = true
hitbox.Size = Vector3.new(7,7,7)
hitbox.Parent = workspace
hitbox.CFrame = self.hrp.CFrame * CFrame.new(0,0,-6)
game.Debris:AddItem(hitbox,.5)
local newZone = ZoneModule.new(hitbox)
newZone.partEntered:Connect(function(v)
if v.Parent:FindfirstChild("Humanoid") and v.Parent.Name ~= self.character.Name then
if not self.HitCD[v.Parent] then
self.HitCD[v.Parent] = true
task.delay(.5,function()
self.HitCD[v.Parent] = nil
end)
local enemyhumanoid = v.Parent:FindFirstChild("Humanoid")
enemyhumanoid:TakeDamage(5)
game.ReplicatedStorage.Remotes.Replicator:FireAllClients( v.Parent:FindFirstChild("HumanoidRootPart))
end
end
end)
end)
self.lasAttackTime = now
local cooldown = (self.combo == 4) and 1.5 or .5
task.delay(cooldown,function()
self.busy = false
end)
if self.combo == 4 then
task.delay(cooldown,function()
self.combo = 0
end)
end
end
return Combat
were shall i put that
but better
irs the same
** You are now Level 2! **
uh why did you not add end)?
task.delay(self.HitboxDelay,function()
local hitbox = Instance.new("Part")
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = .6
hitbox.CastShadow = false
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.Massless = true
hitbox.Size = Vector3.new(7,7,7)
hitbox.Parent = workspace
hitbox.CFrame = self.hrp.CFrame * CFrame.new(0,0,-6)
game.Debris:AddItem(hitbox,.5)
i just uploaded as txt file
nvm
oh no its just in 2 messeges it moved to the right
i see
local newZone = ZoneModule.new(hitbox)
newZone.partEntered:Connect(function(v)
if v.Parent:FindfirstChild("Humanoid") and v.Parent.Name ~= self.character.Name then
if not self.HitCD[v.Parent] then
self.HitCD[v.Parent] = true
task.delay(.5,function()
self.HitCD[v.Parent] = nil
end)
local enemyhumanoid = v.Parent:FindFirstChild("Humanoid")
enemyhumanoid:TakeDamage(5)
game.ReplicatedStorage.Remotes.Replicator:FireAllClients( v.Parent:FindFirstChild("HumanoidRootPart))
end
end
end)
end)
this doesn't have enough ends
which causes an eof error
where should i end it then
or end of file
im gonna edit
full scripttask.delay(self.HitboxDelay,function()
local hitbox = Instance.new("Part")
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = .6
hitbox.CastShadow = false
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.Massless = true
hitbox.Size = Vector3.new(7,7,7)
hitbox.Parent = workspace
hitbox.CFrame = self.hrp.CFrame * CFrame.new(0,0,-6)
game.Debris:AddItem(hitbox,.5)
local newZone = ZoneModule.new(hitbox)
newZone.partEntered:Connect(function(v)
if v.Parent:FindfirstChild("Humanoid") and v.Parent.Name ~= self.character.Name then
if not self.HitCD[v.Parent] then
self.HitCD[v.Parent] = true
task.delay(.5,function()
self.HitCD[v.Parent] = nil
end)
local enemyhumanoid = v.Parent:FindFirstChild("Humanoid")
enemyhumanoid:TakeDamage(5)
game.ReplicatedStorage.Remotes.Replicator:FireAllClients(v.Parent:FindFirstChild("HumanoidRootPart"))
end
end
end)
end)
task.delay(self.HitboxDelay,function()
local hitbox = Instance.new("Part")
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = .6
hitbox.CastShadow = false
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.Massless = true
hitbox.Size = Vector3.new(7,7,7)
hitbox.Parent = workspace
hitbox.CFrame = self.hrp.CFrame * CFrame.new(0,0,-6)
game.Debris:AddItem(hitbox,.5)
local newZone = ZoneModule.new(hitbox)
newZone.partEntered:Connect(function(v)
if v.Parent:FindfirstChild("Humanoid") and v.Parent.Name ~= self.character.Name then
if not self.HitCD[v.Parent] then
self.HitCD[v.Parent] = true
task.delay(.5,function()
self.HitCD[v.Parent] = nil
end)
local enemyhumanoid = v.Parent:FindFirstChild("Humanoid")
enemyhumanoid:TakeDamage(5)
game.ReplicatedStorage.Remotes.Replicator:FireAllClients(v.Parent:FindFirstChild("HumanoidRootPart"))
end
end
end)
end)
i fixed it