Background: So I'm building a game like Clash of Clans, and I notice when I to :MoveTo()
, it doesn't work. Beause I print the Vector3.new(mouse.Hit)
it says 0, 0, 0.
Fail Solution: - I try doing :SetPrimaryPartCFrame()
, it does weird "things".
- I also try doing :TranslateBy()
, it's an error.
local mouse = game.Players.LocalPlayer:GetMouse() local ar = false script.Parent.Equipped:Connect(function() print("TRUE") if ar ~= true then ar = true local f = Instance.new("Folder", workspace.PlayerBuilding) f.Name = game.Players.LocalPlayer.Name local w = game:GetService("Lighting").Level1Wall:Clone() w.Parent = f end end) script.Parent.Unequipped:Connect(function() print("TRUE") ar = false workspace.PlayerBuilding:FindFirstChild(game.Players.LocalPlayer.Name):Destroy() end) while wait(0.01) do if workspace.PlayerBuilding:FindFirstChild(game.Players.LocalPlayer.Name) then local wa = workspace.PlayerBuilding:FindFirstChild(game.Players.LocalPlayer.Name).Level1Wall wa:MoveTo(Vector3.new(mouse.Hit)) end end
At line 24, you have to add "mouse.Hit.p" instead of "mouse.Hit"
local wa = workspace.PlayerBuilding:FindFirstChild(game.Players.LocalPlayer.Name).Level1Wall wa:MoveTo(Vector3.new(mouse.Hit.p))
Also check the Model API for more information on moving the Model
http://wiki.roblox.com/index.php?title=API:Class/Model
I hope I helped you!