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: Can you help me with this script?

Previous Thread :: Next Thread 
RoboX790 is not online. RoboX790
Joined: 05 Nov 2009
Total Posts: 285
04 Sep 2013 10:07 AM
So i want to change the CurrentCamere to a brick in the car and here is the script:

function onChildAdded(child)
if child.Name == "SeatWeld" then
if child.Part1.Name == "Torso" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player ~= nil then
if player.Humanoid.Sit == true then
player.CurrentCamera = script.Parent.Parent.CameraX
end
end
end
end
end

function onChildRemoved()
--camera fix function will be here
end

script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)

OUTPUT:

19:06:55.400 - Humanoid is not a valid member of Player
19:06:55.400 - Script 'Workspace.Model.VehicleSeat.Script', Line 6
19:06:55.401 - stack end
19:06:55.401 - Disconnected event because of exception
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
04 Sep 2013 10:09 AM
player = game.Players[child.Part1.Parent]
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
04 Sep 2013 10:11 AM
ops no

first change camera type to scriptable then set camera object
Report Abuse
RoboX790 is not online. RoboX790
Joined: 05 Nov 2009
Total Posts: 285
04 Sep 2013 10:13 AM
Nope it doesnt work but i updated the script not it gives another error:

function onChildAdded(child)
if child.Name == "SeatWeld" then
if child.Part1.Name == "Torso" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player ~= nil then
if child.Part1.Parent.Humanoid.Sit == true then
child.Part1.Parent.CurrentCamera = script.Parent.Parent.CameraX
end
end
end
end
end

function onChildRemoved()
--camera fix function will be here
end

script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)



Output:

19:12:49.789 - CurrentCamera is not a valid member of Model
19:12:49.790 - Script 'Workspace.Model.VehicleSeat.Script', Line 7
19:12:49.790 - stack end
19:12:49.790 - Disconnected event because of exception
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
04 Sep 2013 10:15 AM
do what i tell you in second post
Report Abuse
RoboX790 is not online. RoboX790
Joined: 05 Nov 2009
Total Posts: 285
04 Sep 2013 10:19 AM
Doesnt work or i didnt get what u said post me the full script?
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