Keep getting did you forget to implement onserverevent?

New to scripting and trying to fix and old tool and i keep get the forget to implement onserverevent? I know im looking past it :man_facepalming:

local input = script.Parent.Input
local mouse_pos = Vector3.new()
local mouse_hit = nil
local mouse_target = nil
local mouse_pos = nil
local player = nil

input.OnServerEvent:Connect(function(client,action,...)
wait()
if client == script.Parent.Parent.Parent then
	if action == 'mouse_pos' then
		local out = ...
		mouse_pos =  out
	elseif action == 'mouse_target' then
		local out = ...
		mouse_target =  out
	elseif action == 'Player' then
		local out = ...
		player =  out
	elseif action == 'mouse_hit' then
		local out = ...
		mouse_hit =  out
	elseif action == 'Down1' then
		local out = ...
		if out == true then
			onButton1Down()
		end
	end
end
end)

function onButton1Down(mouse)

Target = mouse_target
Hit = mouse_hit

if Target:IsDescendantOf(workspace.Bases.RedBase) or Target:IsDescendantOf(workspace.Bases.BlueBase)    and Target.Name ~= "BASE" then
	c = script.Fire:clone()
	c.Parent = Target
	c.Disabled = false 
end


end


function onSelected(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

script.Parent.Selected:connect(onSelected)

Where is the client side? Please show the local script aswell

local Tool = script.Parent
local input = Tool:WaitForChild("Input")

Tool.Deselected:Connect(function(mouse)
input:FireServer("Move",false)
input:FireServer("Selected",false)
end)

Tool.Selected:Connect(function(mouse)

mouse.Icon = "rbxasset://textures\\GunCursor.png"

input:FireServer("Selected",true)
input:FireServer("Player",game.Players.LocalPlayer)

mouse.Button1Down:connect(function()
	input:FireServer("Down1",true)
end)
mouse.Button1Up:connect(function()
	input:FireServer("Down1",false)
end)

mouse.Button1Down:connect(function()
	input:FireServer("Down2",true)
end)
mouse.Button1Up:connect(function()
	input:FireServer("Down2",false)
end)

mouse.KeyUp:connect(function (key)
	input:FireServer("KeyUp",key)
end)

mouse.KeyDown:connect(function (key)
	input:FireServer("KeyDown",key)
end)
	
mouse.Move:connect(function()
	input:FireServer("mouse_hit",mouse.Hit)
	input:FireServer("mouse_pos",mouse.Hit.p)
	input:FireServer("mouse_target",mouse.Target)
	input:FireServer("Move",true)
end)
end)

Sorry i didnt put it

1 Like

Have you tried debugging by using prints?
Try putting several prints in between the codes and see what prints and where it returns an error.

Actually got it working with testing a few times. Now im just trying to figure out how id add fire and smoke effects to the bricks effected by the burn. If you could possibly help. But i do have the tool functioning exactly how it should.

1 Like

Glad to hear.

What do you mean by that?
Something like engulfing those bricks with fire/smoke after being hit or something?

Exactlyyyyyy. The code atm just changes the color(At times will stay one color not sure) when it spreads and explodes sometimes but doesnt add fire nor smoke which id like but not sure how id approach adding it to said script. Ill post it below.

local Model = script.Parent.Parent
Colors = {"Really black","Black","Bright red","Dark orange"}
       
Brightness = script.Parent.BrickColor.r + script.Parent.BrickColor.g + script.Parent.BrickColor.b
Brightness = Brightness
Brightness = math.floor(Brightness+.8)

script.Parent.BrickColor = BrickColor.new(Colors[Brightness])

script.Parent.Transparency = math.random(2,4)*.1

Model.Parent.FireCount.Value = Model.Parent.FireCount.Value + 1
script.Parent:BreakJoints()
a = 1
Burn = true
while Burn do
wait(math.random(2,3))

if a >= 4 then
	if math.random(1,8) == 8 then
		Explosion = Instance.new("Explosion")
		Explosion.Parent = script.Parent
		Explosion.Position = script.Parent.Position
		end
	Burn = false 
end

if Model.Parent.FireCount.Value > 55 then
	Burn = false 
end
a = a + 1

getModel = Model:getChildren()
Distance = 10
Block = nil
if Burn then
	for i=1, #getModel do
		if (getModel[i].Position-script.Parent.Position).magnitude < Distance and getModel[i].Name ~= "BASE" and getModel[i] ~= script.Parent and getModel[i]:findFirstChild("Fire") == nil then 
			Distance = (getModel[i].Position-script.Parent.Position).magnitude
			Block = getModel[i]
			if Distance < 5 then
				break
			end
		end
	end

	if Block ~= nil then
		Clone = script:clone()
		Clone.Parent = Block
	end
end
end

You’d need to create the fire/smoke (using instance.new) and put it right where the part gets destroyed or any other purpose you want.

Basically like the Explosion? that has a Instance.new

Have no idea how but i somehow figured it out thankfully. it spreads, explodes, burns and smokes. Would like it to remove the particles(smoke and fire) after like 10 seconds so it doesnt lag people but it works so not too worried about it