Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

script to clone spawner not working anythin done wrong, i get no errors?

local p = script.Parent
local db = false
p.Touched:Connect(function(h)
	if h.Parent:FindFirstChild("Humanoid") then
		local char = h.Parent
		local plr = game.Players:GetPlayerFromCharacter(char)
		if plr.leaderstats.Recourse.Value >= 10 then
			if db == false then
				db = true
				plr.leaderstats.Recourse.Value -= 10
				print("worked")
				local ab = {script.Parent.Parent.Parent.AvailableSpots:GetChildren()}
				for i, v in pairs(ab) do
					if v.Occupied == false then
						print("occupied is false")
						local clone = game.ReplicatedStorage.GrassDum:Clone()
						print("it cloned")
						clone.Parent = workspace
						print("workspaceparent")
						clone:MoveTo(v.Position)
						print("it shud work since it moved to pos")
					end
					wait(2)
					db = false
			
				end
			end
		end
	end
end)

2 answers

I believe that :MoveTo() is deprecated. I’ve used it before and its always given me problems. Try just setting the cords instead.

1 comment

0

you see i cant just set the pos to the spawn part, since it is a model. I will try looking for another way to move a model. I think if i set a primary part it can also work but thx for this i might approve it if the problem was :MoveTo()

If MoveTo() isn't working, try the newly added feature PivotTo()

PivotTo() works the same as SetPrimaryPartCFrame except you don't need a primarypart.

clone:PivotTo(v.Position)

1 comment

0

wsg so it turns out that idk so yeah um i fixed it somehow but now im onto another error

This discussion is preserved as it was. New answers, comments, and votes are closed.