I want to make a simple dragging system similar to this one.
But this would be for a cooking game
This is what i did (I made this using the devhub roblox tutorial which isn’t the best method)
also, i want to make that the object get in the air like the first video that i shown
I want to see which is the best method for this, and i think that it should be with Raycasting because the collisions are bad, the objects can overlap other objects and pass them.
I would start off by locking the mouse in the center then having a variable with the mouse delta that way you can control the speed of the movements and for the stamp hovering I would just give it a set height above the desk
I don’t want to center the mouse for this, and i can’t set the height with Position or CFrame in my current script.
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local HRP = Character:WaitForChild("HumanoidRootPart")
local Mouse = Player:GetMouse()
local TS = game:GetService("TweenService")
if game.Loaded then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = game.Workspace.CamaraMostrador.CFrame
end
local Point
local Clicking
local Info = TweenInfo.new(0.1)
Mouse.Button1Down:Connect(function()
if Mouse.Target and not Mouse.Target.Locked and Mouse.Target:IsA("BasePart") and Mouse.Target:FindFirstChild("Value") then
Point = Mouse.Target
Mouse.TargetFilter = Point
Clicking = true
end
end)
Mouse.Move:Connect(function()
if Clicking and Point then
local PosX,PosY,PosZ = Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z
local Goal = {Position = Vector3.new(PosX,PosY,PosZ)}
local TSanim = TS:Create(Point,Info,Goal):Play()
--Point.Position = Vector3.new(PosX,PosY,PosZ)
end
end)
Mouse.Button1Up:Connect(function()
Clicking = false
Point = nil
Mouse.TargetFilter = nil
end)
--//Services
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
--//Variables
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local CurrentCamera = workspace.CurrentCamera
--//Controls
local Point = nil
local Clicking = false
local tweenInfo = TweenInfo.new(0.1)
--//Initialization
if game.Loaded then
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = workspace.CamaraMostrador.CFrame
end
--//Functions
Mouse.Button1Up:Connect(function()
Clicking = false
Point = nil
Mouse.TargetFilter = nil
end)
Mouse.Button1Down:Connect(function()
if Mouse.Target and not Mouse.Target.Locked and Mouse.Target:IsA("BasePart") and Mouse.Target:FindFirstChild("Value") then
Point = Mouse.Target
Mouse.TargetFilter = Point
Clicking = true
end
end)
Mouse.Move:Connect(function()
if Clicking and Point then
local TweenAnimation = TweenService:Create(Point, tweenInfo, {Position = Mouse.Hit.Position + Vector3.new(0, Point.Size.Y * 2, 0)})
TweenAnimation:Play()
--[[
Point.Position = Vector3.new(PosX,PosY,PosZ)
]]
end
end)
Actually, that’s really cool !! but i don’t want to make the stamp system, this would be for a cooking system to drop the ingredients, also i don’t know if you are using mouse for that or keyboard, because i want to do it with the mouse
now i need to make the part fall to the place that it needs, the thing is that i don’t know how to use raycast to tween the position in the correct place that it needs to be…