Need help with script

game.ReplicatedStorage.BoatEvents.Spawn.OnServerEvent:Connect(function(plr)

local BoatClone1 = game.ReplicatedStorage.BoatEvents.Boat1:Clone()

BoatClone1.Parent = workspace

BoatClone1.Transform["Origin Position"] = plr.Character.HumanoidRootPart.Position + Vector3.new(50,0,0)

end)

The error: Transform is not a valid member of Model “Workspace.Boat1”

My purpose: I want the ship to spawn 50 studs away from where the player is looking

transform

2 Likes

I think you should use Boat1.CFrame instead of that, origin position won’t work I think

This is model not a part. how do i move models with script

Change this to:

BoatClone1.CFrame = plr.Character.HumanoidRootPart.CFrame + Vector3.new(50,0,0)

try this (also I know that it’s a model because you’re trying to change the “Origin Position” property that it wouldn’t work I think)

(and I’m extremely new to CFrame, but at least I know how to use it)

i told you" CFrame is not a valid member of Model “Workspace.Boat1” "this is a model

The categories are only made for ease in finding properties. Just do this:

game.ReplicatedStorage.BoatEvents.Spawn.OnServerEvent:Connect(function(plr)

local BoatClone1 = game.ReplicatedStorage.BoatEvents.Boat1:Clone()

BoatClone1.Parent = workspace

BoatClone1.OriginPosition = plr.Character.HumanoidRootPart.Position + Vector3.new(50,0,0)

end)

OriginPosition is not a valid member of Model “Workspace.Boat1”

1 Like

oh wait try to use :MoveTo

BoatClone1:MoveTo(plr.Character.HumanoidRootPart.Position + Vector3.new(50,0,0))

(make a PrimaryPart for the boat too)

(and the “Origin Position” property can’t be accessed by scripts)

Ok. First try setting a primary part for the model. If you don’t know how to do that, ask me.
Then, what you have to do is use the function :SetPrimaryPartCframe() on the model. Inside the parenthesis, do (plr.Character:GetPrimaryPartCframe() + Cframe.new(50,0,0).

Try and see if this works. I am unable to properly show you at this time because it is inconvenient for me at this time as I am using a mobile device to type this response. If you can wait for a little bit, I can type the code in a neat fashion :grin:

Ok, well ignore my above comment then :point_up_2:t4::rofl:.

1 Like

It’s fine, both does work

but I used :MoveTo() often

1 Like