|
| 08 Aug 2012 01:31 AM |
Hello. I'm just starting to learn scripting and i'm having some trouble. In the following brick script i made, everything works fine except for the message i'm trying to make appear.
I'm trying to make the message "POWER UP" appear on one player's screen when that player touches the brick. Although i don't know why that won't work. |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
| |
|
|
| 08 Aug 2012 01:32 AM |
Here is the script BTW
local S = game.Workspace.Player local Shumanoid = game.Workspace.Player.Humanoid
function party(hit) hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil then do hit.Transparency = 0.7 hit.BrickColor = BrickColor.new("White") if hum == Shumanoid then do wait(1) hum.Health = hum.Health * 3 local Plr = game.Players:GetPlayerFromCharacter(char) if Plr ~= nil then do local m = Instance.new("Message", Plr.PlayerGui) m.Text = "POWERUP" wait(1) m:remove() wait(1) Shumanoid.Health = Shumanoid.Health + 300 end end end end end end end
script.Parent.Touched:connect(party)
|
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 01:33 AM |
local S = game.Workspace.Player local Shumanoid = game.Workspace.Player.Humanoid
function party(hit) hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil then do hit.Transparency = 0.7 hit.BrickColor = BrickColor.new("White") if hum == Shumanoid then do wait(1) hum.Health = hum.Health * 3 local Plr = game.Players:GetPlayerFromCharacter(char) --You never defined char here. if Plr ~= nil then do local m = Instance.new("Message", Plr.PlayerGui) m.Text = "POWERUP" wait(1) m:remove() wait(1) Shumanoid.Health = Shumanoid.Health + 300 end end end end end end end
script.Parent.Touched:connect(party)
|
|
|
| Report Abuse |
|
|
|
| 08 Aug 2012 01:36 AM |
| I thought that was the way to find the player who touched the brick? What am i doing wrong? |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Aug 2012 03:06 AM |
| bump output says there is nothing wrong |
|
|
| Report Abuse |
|
|
Cheater
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 5258 |
|
|
| 08 Aug 2012 04:10 AM |
function party(hit) hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil then do S = game.Players:GetPlayerFromCharacter(hit.Parent) Shumanoid = hit.Parent:findFirstChild("Humanoid") --quite unnecessary hit.Transparency = 0.7 --Most of all this will be the Leg hit.BrickColor = BrickColor.new("White") --this aswell if hum == Shumanoid then do --What the??? wait(1) hum.Health = hum.Health * 3 local Plr = game.Players:GetPlayerFromCharacter(hit.Parent) --huh? if Plr ~= nil then do --confuzzled local m = Instance.new("Message", Plr.PlayerGui) --aha m.Text = "POWERUP" --sure... wait(1) m:remove() wait(1) Shumanoid.Health = Shumanoid.Health + 300 --WHAT THE? end end end end
script.Parent.Touched:connect(party)
|
|
|
| Report Abuse |
|
|
|
| 08 Aug 2012 05:43 PM |
Lol the last part with shumanoid health plus 300 isn't supposed to be there. I have no idea why it is. Also this brick has no ingame function i'm just testing how to make my scripting work. This is the script. I only copy and pasted bits of it.
local S = game.Workspace.Player local Shumanoid = game.Workspace.Player.Humanoid
function party(hit) hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil then do hit.Transparency = 0.7 hit.BrickColor = BrickColor.new("White") if hum == Shumanoid then do wait(1) hum.Health = hum.Health * 3 local Plr = game.Players:GetPlayerFromCharacter(character) if Plr ~= nil then do local m = Instance.new("Message", Plr.PlayerGui) m.Text = "POWERUP" wait(1) m:remove() wait(1) end end end end end end end
script.Parent.Touched:connect(party)
|
|
|
| Report Abuse |
|
|
|
| 08 Aug 2012 05:44 PM |
Put a localscript in the brick. Then use LocalPlayer. :P |
|
|
| Report Abuse |
|
|
| |
|
| |
|