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: Help with local scripts

Previous Thread :: Next Thread 
fwep67 is not online. fwep67
Joined: 21 Nov 2009
Total Posts: 352
05 Dec 2013 09:43 PM
This script works while in studio, but not when I start a server.

function onTouch(hit)
game.Players.LocalPlayer.Character.Humanoid.Sit = true
end
script.Parent.Touched:connect(onTouch)

How do I make it so if anyone touches the brick, they sit.
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
05 Dec 2013 09:45 PM
I can try, I haven't helped much today so..


function onTouched(hit)
local sit = hit.Parent:FindFirstChild('Humanoid').Sit = true
end

script.Parent.Touched:connect(onTouched)

http://www.roblox.com/LEEDLE-LEEDLE-LEEDLE-LE-PATRICK-STAR-item?id=130781000
Report Abuse
fwep67 is not online. fwep67
Joined: 21 Nov 2009
Total Posts: 352
05 Dec 2013 09:46 PM
Ill try that. Thanks!
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
05 Dec 2013 09:47 PM
The problem is you try to get the local player but that only works when it is in a localscript not a script. Instead use this code:

script.Parent.Touched:connect(function(hit) --this does the same thing as your code
local char = hit.Parent
local hum = char:FindFirstChild("Humanoid").Sit = true
end)
Report Abuse
fwep67 is not online. fwep67
Joined: 21 Nov 2009
Total Posts: 352
05 Dec 2013 09:51 PM
There was an error that said:

19:50:49.488 - Workspace.Part.Script:3: unexpected symbol near '='
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
05 Dec 2013 09:52 PM
Trying using my code.
Report Abuse
fwep67 is not online. fwep67
Joined: 21 Nov 2009
Total Posts: 352
05 Dec 2013 09:54 PM
I did
Report Abuse
BetterBe is not online. BetterBe
Joined: 25 Jan 2009
Total Posts: 1034
05 Dec 2013 09:55 PM
try sweet talking the script.
Report Abuse
fwep67 is not online. fwep67
Joined: 21 Nov 2009
Total Posts: 352
05 Dec 2013 09:56 PM
...
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
06 Dec 2013 01:26 AM
-_-

local hum = char:FindFirstChild("Humanoid").Sit = true This isnt math class. You cant have p = q = r, only p = q


script.Parent.Touched:connect(function(hit) --this does the same thing as your code
local char = hit.Parent
local hum = char:FindFirstChild("Humanoid")
if hum then hum.Sit = true
end
end)
Report Abuse
ancientblackninja is not online. ancientblackninja
Joined: 05 Aug 2011
Total Posts: 401
06 Dec 2013 02:24 AM
I agree with wazap.
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