Here is my code:
local bullet = game.ReplicatedStorage["Cyborg Assets"].bullet
local head = script.Parent.Parent:FindFirstChild("Head")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = Instance.new("RemoteEvent", ReplicatedStorage)
event.Name = "Cyborg SP1"
local function shootbullet()
local debounce = false
local Fireball = bullet:Clone()
print("remoteEvent recieved")
Fireball.BrickColor = BrickColor.new("Institutional white")
Fireball.Transparency = 0
Fireball.TopSurface = 0
Fireball.BottomSurface = 0
Fireball.CanCollide = false
Fireball.Locked = true
Fireball.CFrame = head.CFrame*CFrame.new(0,0,-10)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = Fireball
BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.velocity = head.CFrame.lookVector*40
local function Hurt(Part)
local debounce = false
if debounce == false then
if Part.Parent:FindFirstChild("Humanoid") then
Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health-25
debounce = true
wait(2)
debounce = false
wait()
end
end
Fireball.Touched:connect(Hurt)
wait()
end
event.OnServerEvent:connect(shootbullet)
end
"remoteEvent received" is not appearing inside of the output but when I edit the code to this:
local bullet = game.ReplicatedStorage["Cyborg Assets"].bullet
local head = script.Parent.Parent:FindFirstChild("Head")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = Instance.new("RemoteEvent", ReplicatedStorage)
event.Name = "Cyborg SP1"
local function shootbullet()
local debounce = false
local Fireball = bullet:Clone()
print("remoteEvent recieved")
Fireball.BrickColor = BrickColor.new("Institutional white")
Fireball.Transparency = 0
Fireball.TopSurface = 0
Fireball.BottomSurface = 0
Fireball.CanCollide = false
Fireball.Locked = true
Fireball.CFrame = head.CFrame*CFrame.new(0,0,-10)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = Fireball
BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.velocity = head.CFrame.lookVector*40
end
event.OnServerEvent:connect(shootbullet)
local function Hurt(Part)
local debounce = false
if debounce == false then
if Part.Parent:FindFirstChild("Humanoid") then
Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health-25
debounce = true
wait(2)
debounce = false
wait()
end
end
Fireball.Touched:connect(Hurt)
wait()
end
Also, when I edit it to this way, the "Fireball" never appears.

1 comment
Thanks.