yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 15 Apr 2015 02:17 AM |
At the bottom you will see a script which rotates the model 90 degrees, however whenever the mouse moves and triggers the move event, the brick goes back to its original rotation - how can i prevent this?
local mouse = game.Players.LocalPlayer:GetMouse() local mouseClickDeb = false local thisItem = script.Parent.Name local selector local mainItem = game.Lighting:FindFirstChild(thisItem).PrimaryPart local buttonClicked = false local sActive = false-- Is there a selector already? local Money = script.Parent.Parent.Parent.Parent:WaitForChild("Money").Money
game.Lighting:FindFirstChild(thisItem).PrimaryPart = game.Lighting:FindFirstChild(thisItem).Main
function buttonClick() buttonClicked = true if selector then selector:Destroy() -- Destroy old selector end if sActive == false then sActive = true selector = game.Lighting:FindFirstChild(thisItem):Clone() selector.Parent = game.Workspace selector.PrimaryPart = selector.Main selector.Name = "selector" end end
script.Parent.MouseButton1Click:connect(buttonClick)
function mouseMove() if sActive == true then local mh = mouse.Hit mouse.TargetFilter = selector if mouse.Target ~= selector then selector:SetPrimaryPartCFrame(CFrame.new(mh.p)) end end end
mouse.Move:connect(mouseMove)
function mouseClick() if sActive == true and mouseClickDeb == false then if Money.Value >= 40 then Money.Value = Money.Value - 40 local selectorPos = selector.PrimaryPart.Position local selectorRot = selector.PrimaryPart.CFrame selector:Destroy() sActive = false local HouseCreated = game.Lighting:FindFirstChild(thisItem):Clone() HouseCreated.Name = game.Players.LocalPlayer.Name HouseCreated.Parent = game.Workspace HouseCreated:MoveTo(selectorPos) HouseCreated.PrimaryPart.CFrame = selectorRot script.Parent.Parent.Parent.HospitalA.Value = script.Parent.Parent.Parent.HospitalA.Value + 1 mouseClickDeb = true wait(0.5) mouseClickDeb = false else mouseClickDeb = true selector:Destroy() sActive = false local needMoreMoney = Instance.new("Message", game.Workspace) needMoreMoney.Text = "You need "..40-Money.Value.." more $" wait(3) needMoreMoney:Destroy() wait(0.5) mouseClickDeb = false end end end
mouse.Button1Down:connect(mouseClick)
mouse.KeyDown:connect(function(key) if sActive == true then selector:SetPrimaryPartCFrame(selector.PrimaryPart.CFrame * CFrame.Angles(0,math.rad(90),0)) end end)
|
|
|
| Report Abuse |
|
|
|
| 15 Apr 2015 02:26 AM |
Rotate the model from its original rotation?
-Get the model's rotation -Once mouse is moved, -Move model to position -Set original rotation
Something with this concept i guess :P |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
| |
|
|
| 15 Apr 2015 11:54 AM |
| Go to hell and take your bumps with you. |
|
|
| Report Abuse |
|
|
yobo89
|
  |
| Joined: 05 Jun 2010 |
| Total Posts: 2341 |
|
|
| 15 Apr 2015 12:00 PM |
| OK , this isn't a bump its a..... LUMP |
|
|
| Report Abuse |
|
|