How could I a movement system like in the video below? where do I start?
Never done this before, but I think it works by getting the mouse’s target position and then “tweening” the little villager model. Again, I don’t have an in-depth explanation.
There are 2 ways, you can make your own pathfinding with raycasting, tweens or using the roblox ones.
To be honest, the roblox pathfinding is the most broken thing ever but you can read more about it here: Character Pathfinding (roblox.com)
If the villagers are mesh parts
- in a local script:
---- Services ----
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
---- Instances ----
local TweenModel = THEMODELYOUWANTTOTWEEN
local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local function GoToMouse()
TweenService:Create(TweenModel, TweenInfo.new(1), {Position=Mouse.Target.Position}):Play()
end
Mouse.Button1Down:Connect(GoToMouse)
This sounds like a very good way to do it, also, how would I make it so the player is able to select the villager?
I get this error:
TweenService:Create no property named 'Position' for object 'Test'
(“Test” is my model)
You can use this:
game:GetService(“Players”):GetMouse().Target
What I said above was for tweening a BasePart.
If you want to tween a model you can check this topic: Introduction to Tweening Models. It is very well made, you should find what you’re trying to achieve!
I don’t want the model to collide with anything while its moving to the desired position.
FWIW: Setting CFrame doesn’t perform collision checks or occupancy checks. Setting position will perform this check so that the instance whose position is being set can be moved into an unoccupied area that will fit the instance.
Would this be used with path finding?