Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make this script work for models instead of just 1 part?

Asked by 6 years ago
Edited 6 years ago

I have a moving system that lets you move crates (Made Of Just 1 Part) around and snaps to 1 stud (script is a local script located in game.StarterPack):

01local player = game.Players.LocalPlayer
02local mouse = player:GetMouse()
03local point
04local down
05 
06function clickObject()
07if mouse.Target ~= nil then
08if mouse.Target.Parent.Name == "Crate" then
09point = mouse.Target
10mouse.TargetFilter = point
11down = true
12end
13end
14end
15mouse.Button1Down:Connect(clickObject)
View all 31 lines...

When I tried to make it move the entire model I tried this:

01local player = game.Players.LocalPlayer
02local mouse = player:GetMouse()
03local point
04local down
05 
06function clickObject()
07if mouse.Target ~= nil then
08if mouse.Target.Parent.Name == "Crate" then
09point = mouse.Target
10mouse.TargetFilter = point
11down = true
12end
13end
14end
15mouse.Button1Down:Connect(clickObject)
View all 32 lines...

But when I use the new script it seems very glitchy because the crate teleports back and fourth, Could someone show me how make the first script move the entire crate model with out it teleporting back and fourth?

0
Not really an answer but try using SetPrimaryPartCFrame instead to avoid collisions. Asentis 17 — 6y

Answer this question