Cloned clickdetector doesnt work after cloning in gametest?

i have a mostly working tower defense, and the towers have an upgrade system, however, if i duplicate the tower ingame, not in studio, the cloned towers click detector breaks.

image:
image

if you need any code, feel free to ask.

Thank you for reading.

Are u sure ur referring to the cloned model and not the original one?

yes, the original model works, but the cloned model doesn’t, it works when i clone it in studio, but not when i do it in-game.

Did u publish the game? Try pressing alt p and then wait a minute, then play from the website.

the game is published and i have tried it before, but thats not what im asking, when i clone the tower in studio, not in playtest, the tower works, but when i clone it in studio play testing, it wont open, the clickdetector won’t budge.

Well, can I see your code? I can’t help u without seeing what ur doing

sure, give me a minute, i have a script.

UpgradeGui:

TweenService = game:GetService("TweenService")

local val = script.Parent.Parent.Parent.Configuration.Range
local goal = {
	Size = Vector3.new(0.5, val.Value, val.Value)
}

script.Parent.MouseClick:Connect(function(x)
	wait(0.1)
	print(script.Parent.Parent.Parent:GetChildren())
	local gui = script.Parent.Parent.Parent.Info2
	if x.PlayerGui.ScreenGui:FindFirstChild("Info2") then
		-- remove the range lol
		local info2 = x.PlayerGui.ScreenGui:FindFirstChild("Info2")
		local range = info2.Model.Value.Range
		local goal = {
			Size = Vector3.new(0.5, 0.25, 0.25)
		}
		x.PlayerGui.ScreenGui.Info2.Parent = x.PlayerGui.ScreenGui.Info2.Model.Value

		local tweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Quad)
		local tween = TweenService:Create(range, tweenInfo, goal)
		tween:Play()
		tween.Completed:Wait()
		range.Transparency = 1


	end
	local range = script.Parent.Parent.Parent.Range
	gui.Parent = x.PlayerGui.ScreenGui
	range.Transparency = 0.75
	local tweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Quad)
	local tween = TweenService:Create(range, tweenInfo, goal)
	tween:Play()


end)

this is the scripts where the clickdetector wouldn’t budge.

The script is local or server-sided? Could you perhaps try disabling and enabling it from another script when cloning it?

YourScript.Disabled = true
YourScript.Disabled = false

the script is server sided, and okay, i’ll try it.

and just to clear things up, i am cloning it manually, not with scripts, so when i am in the playtest, i would clone it, but ill try to make a script to do it.

Bruh ok. Btw, cloning is as simple as doing object:Clone() if u didn’t know.

yeah, i know that, i just didnt try it.

When duplicating the tower ingame with the studio tools, its not going to initialize its code considering during runtime it likely wont compile and initialize the program.

This goes for whenever assets are cloned into the running environment i believe.

This is what im getting from what you have said up to now.

yeah, i am pretty sure that is what is happening, the clickdetector is not initializing at all, but i do not know how to fix that.

There is no fix for it, its the nature of studio. Its also unrealistic considering you wont be doing that in a game server anyways. There is a good reason for that.

oh, okay, thanks anyway.
30 ch ar s