Why ‘Position’ not working?
Can you send your code?
Also I think you might have to set a primary part if you wanna set a model’s position, not sure about that though.
I’m pretty sure a model’s position is relative to it’s primary part
try using workspace.Dropper:PivotTo([target CFrame])
to move the model to where you want to
Code:
local ServerStorage = game:GetService("ServerStorage")
local part = script.Parent
local DataStoreService = game:GetService("DataStoreService")
--local bee_data = DataStoreService:GetDataStore("bee_data")
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local playerId = player.UserId
--local success, currentGold = pcall(function()
-- return bee_data:GetAsync("Sıra" ..playerId)
--end)
local location_part = workspace.Tycoon.Bir_Sira:WaitForChild("1")
print("cliked")
local dropper = ServerStorage:WaitForChild("Dropper")
local clonedmodel = dropper:Clone()
wait(1)
clonedmodel.Parent = workspace
task.wait(1)
clonedmodel.Position = location_part.Position
end)
I’ve got nothing too useful, but yes, a models position is relative to its primary part.
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local playerId = player.UserId
--local success, currentGold = pcall(function()
-- return bee_data:GetAsync("Sıra" ..playerId)
--end)
local location_part = workspace.Tycoon.Bir_Sira:WaitForChild("1")
print("cliked")
local dropper = ServerStorage:WaitForChild("Dropper")
local clonedmodel = dropper:Clone()
wait(1)
clonedmodel.Parent = workspace
task.wait(1)
clonedmodel:PivotTo(location_part.CFrame)
end)
try this maybe
I don’t see any mistakes in your code, try giving the model a PrimaryPart, and change the PrimaryPart’s position (this might require a bit of messing around).
Now that I think about it, wouldn’t CFrame = CFrame.new() be a better solution? Could never decide which one is better
CFrame sets both position and orientation, I don’t see why that wouldn’t be a bit simpler
might be but you have to now put the location_part
’s x, y and z into the CFrame.new which is kind of long to do
Thank you.
Please explain what is PrimaryPart?
also you want the player to touch the part right? because this might cause problems as it will fire many times over
To put it simply, you can’t just set a whole model’s CFrame. You’re going to need to use one of two methods
- Primary Part Welding. Just weld all the parts in the model to the primary part, and set the primary part’s CFrame. This will move the whole model as a result, and is also used for tweening models.
- PivotTo(). This is the easier version that requires no welding. You just have to do
model:PivotTo(otherModel:GetPivot())
. Though it is simpler, you cannot tween it without complicated methods.
Yes I know it will be a problem but since this is a test I didn’t care about it.
PrimaryPart
is a special property of Models
. To put it simply, it’s the physical reference for the whole model. See more here:
the primary part is like a reference point for a model and in a model, everything pretty much revolves around the primarypart
Uhhhh, it’s like uh
This might be a horrible explanation
It’s basically a parent of all parts in a model, maybe something along priority, but basically PrimaryPart is the parent of any other part inside the model.
alright then, did using PivotTo throw any errors?
No. Dont giving error. aaaaaaaaa