Script not working after cloning a model to client's workspace

Is your pumpkin a model? And if so, are you sure that its destroying the entire model and not just the part you touched?

1 Like

Yes, I checked to see if the entire model was being destroyed and it looks like it. It no longer appeared in the workspace for me.

Edit: My only thought is maybe the pet is causing the issue, since it’s attached to the player’s character model.

1 Like

Is cancollide on for the pets?

1 Like

No, CanCollide is off for the pets.

1 Like

I have to go soon to run a few errands rl but can you screenshot the local script and one of the pumpkins in workspace with its children (if it has any)?

I’ll most likely respond once I’m back.

1 Like

Sure thing, if you’d like we can discuss this further in DMs on here or Discord. If you prefer Discord, mine is: RetroGaming102#8737

Edit: Here are the pictures and scripts.

LocalScript:

This is the PumpkinListner one, it’s within StarterPlayerScripts.

local RS = game:GetService("ReplicatedStorage")

local PumpkinRemoveEvent = RS:WaitForChild("PumpkinEvent")

PumpkinRemoveEvent.OnClientEvent:Connect(function(ThePumpkinToRemove)
	if ThePumpkinToRemove and ThePumpkinToRemove:IsA("Model") then
		ThePumpkinToRemove:Destroy()
	end
end)

Pumpkin in workspace and its script:

In the other parts it’s just a WeldConstraint.
image

local PS = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local BS = game:GetService("BadgeService")

local PumpkinRemoveEvent = RS:WaitForChild("PumpkinEvent")
local pumpkinPart = script.Parent.Parent

local amount = 1
local maxAmount = 10
local toggle = false

pumpkinPart.Detection.Touched:Connect(function(Hit)
	local Player = PS:GetPlayerFromCharacter(Hit.Parent)
	local leaderboard = Player:FindFirstChild("Pumpkin Leaderboard")
	local number = leaderboard.Pumpkins
	if Player and toggle == false then
		toggle = true
		print("Pumpkin Touched by "..Player.Name)
		PumpkinRemoveEvent:FireClient(Player, pumpkinPart)
		--Add to PumpkinGUI
		if number.Value < 10 then
			number.Value = number.Value + amount
			print("Added to total...")
			wait()
			-- Awards badge if player gets 10
			if number.Value == maxAmount then
				BS:AwardBadge(Player.userId, script.Parent.BadgeID.Value)
				print("Awarded Badge")
			end
			wait(0.2)
			toggle = false
		end
	end
end)
1 Like