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: Some help with my brick script

Previous Thread :: Next Thread 
StickyPigeon is not online. StickyPigeon
Joined: 29 Feb 2012
Total Posts: 40
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 is not online. Cheater
Joined: 29 Jun 2007
Total Posts: 5258
08 Aug 2012 01:31 AM
Script, please.
Report Abuse
StickyPigeon is not online. StickyPigeon
Joined: 29 Feb 2012
Total Posts: 40
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 is not online. 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
StickyPigeon is not online. StickyPigeon
Joined: 29 Feb 2012
Total Posts: 40
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
StickyPigeon is not online. StickyPigeon
Joined: 29 Feb 2012
Total Posts: 40
08 Aug 2012 01:57 AM
Bumps.
Report Abuse
StickyPigeon is not online. StickyPigeon
Joined: 29 Feb 2012
Total Posts: 40
08 Aug 2012 03:06 AM
bump output says there is nothing wrong
Report Abuse
Cheater is not online. 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
StickyPigeon is not online. StickyPigeon
Joined: 29 Feb 2012
Total Posts: 40
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
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
08 Aug 2012 05:44 PM
Put a localscript in the brick.
Then use LocalPlayer.
:P
Report Abuse
StickyPigeon is not online. StickyPigeon
Joined: 29 Feb 2012
Total Posts: 40
08 Aug 2012 08:55 PM
Thank yoooouz :D
Report Abuse
zackeryjerrypowers is not online. zackeryjerrypowers
Joined: 01 Aug 2008
Total Posts: 1515
10 Aug 2012 02:57 PM
No problem.
;D
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