march96
|
  |
| Joined: 28 Apr 2009 |
| Total Posts: 438 |
|
|
| 16 Jul 2011 08:33 PM |
enabled = true function onHit(hit) local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) and not enabled then return end enabled = false local user = game.Players:findFirstChild(hit.Parent.Name) if user ~= nil then
local message = script.Parent.Message:clone()
message.ImageLabel.ImageLabel = "" message.Parent = user.PlayerGui wait(2) if message ~= nil then message:remove() wait(0.2) enabled = true else wait(0.2) enabled = true end end end
script.Parent.Touched:connect(onHit)
Can someone fix this script so that when someone steps on a brick an image will appear. I tried to edit this myself,but it doesn't really work. |
|
|
| Report Abuse |
|
|
OBF
|
  |
| Joined: 29 Sep 2009 |
| Total Posts: 10709 |
|
|
| 16 Jul 2011 08:35 PM |
enabled = true function onHit(hit) local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) and not enabled then return end enabled = false local user = game.Players:findFirstChild(hit.Parent.Name) if user ~= nil then
local message = script.Parent.Message:clone()
message.ImageLabel.Image = "" message.Parent = user.PlayerGui wait(2) if message ~= nil then message:remove() wait(0.2) enabled = true else wait(0.2) enabled = true end end end
script.Parent.Touched:connect(onHit |
|
|
| Report Abuse |
|
|
march96
|
  |
| Joined: 28 Apr 2009 |
| Total Posts: 438 |
|
| |
|
OBF
|
  |
| Joined: 29 Sep 2009 |
| Total Posts: 10709 |
|
|
| 16 Jul 2011 08:38 PM |
| If you actually read the script, you'd find what I changed. |
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 16 Jul 2011 08:39 PM |
enabled = true function onHit(hit) local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) or not enabled then return end --Or it will end it if either happens; you had it so that it would only end if both happened enabled = false local user = game.Players:findFirstChild(hit.Parent.Name) if user ~= nil then
local message = script.Parent.Message:clone()
message.ImageLabel.ImageLabel.Image = "" --I'm guessing this is changing the image? It would error due to only getting to the label. message:clone().Parent = user.PlayerGui --You need to clone it, or it will error after one usage. wait(2) if message ~= nil then message:remove() wait(0.2) enabled = true else wait(0.2) enabled = true --For the previous few lines, you could have had a end and put wait(0.2) and enabled = true once. end end end
script.Parent.Touched:connect(onHit) |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2011 08:40 PM |
enabled = true function onHit(hit) local human = hit.Parent:findFirstChild("Humanoid")
if human==nil or not enabled then return end enabled = false local user = game.Players:playerFromCharacter(hit.Parent.Name) if user ~= nil then
local message = script.Parent.Message:clone()
message.ImageLabel.ImageLabel = "" --img message.Parent = user.PlayerGui wait(2) if message ~= nil then message:remove() wait(0.2) enabled = true else wait(0.2) enabled = true end end end
script.Parent.Touched:connect(onHit)
You had if humanoid~=nil for return end, you want if it's nil return end. |
|
|
| Report Abuse |
|
|
march96
|
  |
| Joined: 28 Apr 2009 |
| Total Posts: 438 |
|
|
| 16 Jul 2011 08:40 PM |
| . . . Oh,I see.. I am so sorry! <_> I'm the idiot.. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2011 08:43 PM |
| It happens. I've taken an hour doing countless fixes to a script just to realize I've misspelled one word. lul |
|
|
| Report Abuse |
|
|
march96
|
  |
| Joined: 28 Apr 2009 |
| Total Posts: 438 |
|
| |
|