I've had these types of issues and it's actually getting pretty annoying and frustrating.

The client-side script works perfectly, but when the client-side script fires a RemoteEvent after being cloned, the server script doesn't even hear it and just breaks.

Here's the script: (client)

local tool = script.Parent
local player = game.Players.LocalPlayer
local char = workspace:WaitForChild(player.Name)
local hum = char:WaitForChild('Humanoid')
local mouse = player:GetMouse()
local rs = game:GetService("RunService")
local canPreview = true
local canPlace = true
local canUse = true
local printersPlaced = player:WaitForChild("PrintersPlaced")

local preview = game.ReplicatedStorage.Printer:Clone()
tool.Equipped:Connect(function()
	if canUse == true then
		canPreview = true
		preview.Parent = workspace
		preview.Transparency = 0.5
		preview.CanCollide = false
	end
	if printersPlaced.Value >= 2 then
		canPreview = false
		canPlace = false
	end
end)
tool.Activated:Connect(function()
	if canPlace == true and printersPlaced.Value <= 2 then
		printersPlaced.Value = printersPlaced.Value + 1
		tool.Place:FireServer(preview.Position,hum)
		game.StarterPlayer.Place:Play()
		preview.Parent = nil
		if printersPlaced.Value >= 2 then
			canPlace = false
			canUse = false
		end
	end
end)
tool.Unequipped:Connect(function()
	canPreview = false
	preview.Parent = nil
end)

tool.Place.OnClientEvent:Connect(function()
	tool:remove()
end)
	
rs.RenderStepped:Connect(function()
	if canPreview == true then
		preview.Position = mouse.Hit.p + Vector3.new(0,preview.Size.Y/2,0)
	end
end)

Here's my server-side script:

local printInterval = 250
local timeDelay = 5
local maxPrint = 3000

script.Parent.Place.OnServerEvent:Connect(function(player,pos,hum)
	local printersPlaced = player:WaitForChild("PrintersPlaced")
	if printersPlaced.Value <= 2 then
		local clone = game.ReplicatedStorage.Printer:Clone()
		clone.Parent = workspace
		clone.Position = pos
		clone.Name = player.Name.."_printer"
		clone.SurfaceGui.Title.Text = player.Name.."'s printer"
		clone.SurfaceGui.Printed.Text = "Money printed: $0"	clone.MoneyStored.Changed:Connect(function()
			clone.SurfaceGui.Printed.Text = "Money printed: $"..clone.MoneyStored.Value
		end)
		
		clone.ClickDetector.MouseClick:Connect(function()
			print("Give $"..clone.MoneyStored.Value.." to "..player.Name)
			if clone.MoneyStored.Value >= maxPrint then
				clone:remove()
			end
		end)
			
		game.Players.PlayerRemoving:Connect(function()
			for i,v in pairs(workspace:GetChildren()) do
				if v.Name == player.Name.."_printer" then
					v:remove()
				end
			end
		end)
		
		repeat
			clone.MoneyStored.Value = clone.MoneyStored.Value + printInterval
			clone.Printer:Play()
			wait(timeDelay)
		until
		clone.MoneyStored.Value >= maxPrint
		script.Parent.Place:FireClient(player)
	end
end)

I don't know why ROBLOX does this every single time...

Help is appreciated!

3 comments

0

By break, do you mean an error? if so, what is it?

0

Just curious, it would help if you told us why you wanted to clone a remote event.

0

@TheMinecraftSmarts No that's not what I mean. The tool that has the remote event is being cloned.