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 » Scripting Helpers
Home Search
 

Re: LogPose script, I need help with the math ._.

Previous Thread :: Next Thread 
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
21 Nov 2012 09:38 PM
Well, I copied a simple compass script from free models and moded it. I'm not the best with vectors, so I need some help. The script is supposed to make the image point to the direction of where the closest island is (Like in One Piece :d)

Here is my script:

---------------------- IQNORE/PROOF I DID NOTHING WRONG --------------------------
wait(0.5)
local player = game.Players.LocalPlayer
local character = game.Workspace:FindFirstChild(player.Name)
if character == nil then
script.Parent:Destroy()
end
local target = character.Torso

function findisland()
findmag = 5000000
thetar = nil
g = game.Workspace.Islands:GetChildren()
for i = 1,#g do
if (g[i].Position - target.Position).Magnitude < findmag then
findmag = (g[i].Position - target.Position).Magnitude
thetar = g[i]
end
end
return thetar
end
---------------------------------------------------------------------------



--Here is where the problem is:

repeat wait(0.01)
local C = game.Workspace.CurrentCamera
local tar = findisland()

local Direction = (
Vector2.new(
tar.Position.x,tar.Position.z)-
Vector2.new(
C.Focus.x,C.Focus.z)
).unit

-- I'm having troubles with the part above here

script.Parent.Circle.N.Position = UDim2.new(0.5,-Direction.x*80,0.5,Direction.y*80)
until script == nil
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
21 Nov 2012 09:39 PM
Oh, and yes. This is in a local script. If you need more information please ask me.
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
21 Nov 2012 09:45 PM
And oh yea, It's not C.Focus.x/C.Focus.z, it's C.CoordinateFrame.x/C.CoordinateFrame.z!!!
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
21 Nov 2012 09:50 PM
Sigh- Nevermind. I probably sound like a noob right now.
Report Abuse
Octopus is not online. Octopus
Joined: 26 Feb 2008
Total Posts: 460
21 Nov 2012 10:15 PM
What does the output say?
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
22 Nov 2012 06:22 PM
IT doesn't say anything. Everything in the script works, it's just that I'm having a hard time with the math.
Report Abuse
nrscsy is not online. nrscsy
Joined: 09 Nov 2012
Total Posts: 465
22 Nov 2012 06:30 PM
If you describe how your math is faulty, then we will have it easier.
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
22 Nov 2012 06:55 PM
Ok. Should I give you a model to fix instead? You will probably not understand what i'm trying to do with just words.
Report Abuse
palk47 is not online. palk47
Joined: 07 May 2009
Total Posts: 508
22 Nov 2012 07:00 PM
Here's the model Btw: http://www.roblox.com/Broken-LogPose-item?id=98556943
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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