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 |
|
|
|
| 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
|
  |
| Joined: 21 Nov 2009 |
| Total Posts: 352 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
| |
|
fwep67
|
  |
| Joined: 21 Nov 2009 |
| Total Posts: 352 |
|
| |
|
BetterBe
|
  |
| Joined: 25 Jan 2009 |
| Total Posts: 1034 |
|
|
| 05 Dec 2013 09:55 PM |
| try sweet talking the script. |
|
|
| Report Abuse |
|
|
fwep67
|
  |
| Joined: 21 Nov 2009 |
| Total Posts: 352 |
|
| |
|
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 |
|
|
| |
|