I am trying to make a button that when clicked it will clone a model and will be positioned at a coordinate frame. However it seems to not be working. I have put it through printing tests and it all runs well but the output says "Could not cast vector3 coordinate". Because of this I changed it to cframe, here is the code.
script.Parent.MouseClick:Connect(function(plr) if game.Workspace.Data.Buildingname.Value == ("ArcherHut") then -- Checks for data local Clone = game.Workspace.ArcherHut:Clone() Clone.Parent = game.Workspace Clone.Name = ("Tile1") Clone:SetPrimaryPartCframe(CFrame.new(-731.5, 6.5, -2676.5)) -- What's not working end end)
Hey wolftamer894,
I have just resolved this issue by resetting the Primary Part.
Here is my Workspace picture.
Here is the new code: It's a very minor change however a PrimaryPart does not transfer between models:
script.Parent.MouseClick:Connect(function(plr) if game.Workspace.Data.Buildingname.Value == ("ArcherHut") then -- Checks for data local Clone = game.Workspace.ArcherHut:Clone() Clone.Parent = game.Workspace Clone.Name = ("Tile1") Clone.PrimaryPart = Clone["ArcherHut"] -- My primaryPart is called ArcherHut Clone:SetPrimaryPartCFrame(CFrame.new(-731.5, 6.5, -2676.5)) end end)
Hope this helped. Any issues? Feel free to contact me!
Cheers, Orcazate