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: Failed Attempt to make arms point to mouse, help?

Previous Thread :: Next Thread 
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
25 Dec 2013 11:04 AM
I use 2 scripts, a Script to update the fake arm positions and a LocalScript to update a CFrameValue of Mouse.Hit position. The fake arms aren't being CFramed correctly, they go into bizzare positions like 0,-100000,0.

When a character is added, fake arms and some other stuff are parented to the character and are also inserted into a table. When a character is removed, the fake arms are removed from the table. Every frame, the arms in the table are supposed to be updated to the correct positions. THIS DOES NOT USE WELDS.

The LocalScript just constantly updates a CFrameValue's Value to Mouse.Hit.p.

Script:

FakeArms = {
["Right Arms"] = {};
["Left Arms"] = {}
}
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
repeat wait() until char
rarm = char["Right Arm"]:Clone()
larm = char["Left Arm"]:Clone()
mousepointupdater = script.MousePointUpdate:Clone()
Instance.new("CFrameValue",mousepointupdater).Name = "MousePoint"
mousepointupdater.Parent = char
rarm.Anchored = true
larm.Anchored = true
FakeArms["Right Arms"][player.Name] = rarm
FakeArms["Left Arms"][player.Name] = larm
rarm.Parent = char
larm.Parent = char
rarm.Name = "Fake Right"
larm.Name = "Fake Left"
char["Right Arm"].Transparency = 1
char["Left Arm"].Transparency = 1
end)
end)

game.Players.PlayerRemoving:connect(function(player)
player.CharacterRemoving:connect(function()
FakeArms["Right Arms"][player.Name] = nil
FakeArms["Left Arms"][player.Name] = nil
end)
end)

game:GetService("RunService").Heartbeat:connect(function(step)
for i, v in pairs(FakeArms["Right Arms"]) do
local char = v.Parent:FindFirstChild("Torso")
if char and char:FindFirstChild("Right Shoulder") and char:FindFirstChild("Left Shoulder") and char.Parent:FindFirstChild("MousePointUpdate") then
v.CFrame = CFrame.new(Vector3.new(char.CFrame.p+char.CFrame:vectorToWorldSpace(Vector3.new(char["Right Shoulder"].C0.p))),
Vector3.new(v.Parent.MousePointUpdate.MousePoint.Value))
end
end
for i, v in pairs(FakeArms["Left Arms"]) do
local char = v.Parent:FindFirstChild("Torso")
if char and char:FindFirstChild("Right Shoulder") and char:FindFirstChild("Left Shoulder") and char.Parent:FindFirstChild("MousePointUpdate") then
v.CFrame = CFrame.new(Vector3.new(char.CFrame.p+char.CFrame:vectorToWorldSpace(Vector3.new(char["Left Shoulder"].C0.p))),
Vector3.new(v.Parent.MousePointUpdate.MousePoint.Value))
end
end
end)





LocalScript:

repeat wait() until game.Players.LocalPlayer
player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.Changed:connect(function(property)
if property == mouse.Hit or property == "Hit" then
script.MousePoint.Value = mouse.Hit.p
end
end)




Here is a model to it if you need it:

http://www.roblox.com/Under-Developement-Point-to-mouse-item?id=139794815
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
25 Dec 2013 11:07 AM
Btw, the Script is 48 lines long and the LocalScript is 8 lines long.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
25 Dec 2013 08:36 PM
v.CFrame = CFrame.new(Vector3.new(char.CFrame.p+char.CFrame:vectorToWorldSpace(Vector3.new(char["Left Shoulder"].C0.p))),
Vector3.new(v.Parent.MousePointUpdate.MousePoint.Value))

maybe this? Help please
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
25 Dec 2013 09:18 PM
lol
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
25 Dec 2013 10:09 PM
go go go
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
25 Dec 2013 10:33 PM
Apparently the Changed event does not fire when Mouse.Hit changes. I tried

repeat wait() until game.Players.LocalPlayer
player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.Move:connect(function()
script.MousePoint.Value = mouse.Hit
end)

but still no. Help?

Good night for now
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 12:20 PM
helpppp
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 01:27 PM
...
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 04:23 PM
pleeaasee
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 06:16 PM
meanies
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 08:09 PM
Come on....
Report Abuse
LordGando is not online. LordGando
Joined: 05 Jul 2011
Total Posts: 6723
26 Dec 2013 08:17 PM
game.Players.LordGando:MindBlow()
end

-LᴏʀᴅGᴀɴᴅᴏ - Cows make milk, I drink milk http://woobox.com/6gs8j6/vote/for/1518073
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 08:42 PM
@Lord

Error: Attempt to call a nil value

NOW HELP ME PLEAAASSEEEE
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 10:05 PM
y u be ignore
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
26 Dec 2013 10:06 PM
cus only cntkillme knows this stuff
and u
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 10:14 PM
wat

http://wiki.roblox.com/index.php/CFrame#Constructors

CFrame.new(Vector3 position, Vector3 point)

ogm mindblown
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
26 Dec 2013 10:40 PM
um so where is everybody
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
27 Dec 2013 08:42 AM
stahp ignoring me im sad
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
27 Dec 2013 09:27 AM
lololololbump
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
27 Dec 2013 09:52 AM
um anyone
Report Abuse
marioblox1094 is not online. marioblox1094
Joined: 14 Aug 2010
Total Posts: 1839
27 Dec 2013 10:26 AM
LordGando - line 2 - EOF expected at 'end'
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
27 Dec 2013 10:33 AM
ima make a new clean thread with an updated, yet still broken script that fixes the LocalScript problem. I still need it to point to mouse. Just let this thread die and let me post a new one.
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