generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Rotating(AGain - sorry)

Previous Thread :: Next Thread 
yobo89 is not online. 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
KiwiTronik is not online. KiwiTronik
Joined: 18 Feb 2010
Total Posts: 3221
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 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 02:29 AM
How do i fix then?
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 02:53 AM
b
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 03:37 AM
bb
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 06:43 AM
bbb
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 07:35 AM
bbbb
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 09:44 AM
bbbbb
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 11:17 AM
bbbbbb
Report Abuse
yobo89 is not online. yobo89
Joined: 05 Jun 2010
Total Posts: 2341
15 Apr 2015 11:48 AM
bbbbbbb
Report Abuse
Scripterity is not online. Scripterity
Joined: 30 Mar 2014
Total Posts: 677
15 Apr 2015 11:54 AM
Go to hell and take your bumps with you.
Report Abuse
yobo89 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image