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: I need some help

Previous Thread :: Next Thread 
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
12 Jul 2012 11:31 AM
I have this script, and what it is supposed to do is when you touch it, if you have the right item in your inventory, it will allow you to go in. Otherwise, it will display a GUI saying "You Do Not Have TresureMap1, come back when you have it.
function check(hit)
local a = game.Players[hit.Parent.Name]
if a.Backpack:FindFirstChild("TresureMap1") == nil then
local b = Instance.new("ScreenGui")
b.Parent = a.PlayerGui
local c = Instance.new("TextBox")
c.Parent = b
c.Position = {0, 245}, {0, 100}
c.Size = {0, 320}, {0, 30}
c.Text = "You Do Not Have TresureMap1, come back when you have it"
wait(5)
b:Remove()
else
script.Parent.CanCollide = false
wait(5)
script.Parent.CanCollide = true
end
end

script.Parent.Touched:connect(check)
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
12 Jul 2012 11:39 AM
function check(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local playa = game.Players:GetPlayerFromCharacter(hit.Parent)
if playa and playa:FindFirstChild("Backpack") and playa.Backpack:FindFirstChild("TresureMap1") == nil then
local b = Instance.new("ScreenGui")
b.Parent = playa.PlayerGui
local c = Instance.new("TextBox")
c.Parent = b
c.Position = UDim2.new(0, 245, 0, 100)
c.Size = UDim2.new(0, 320, 0, 30)
c.Text = "You Do Not Have TresureMap1, come back when you have it"
wait(5)
b:Destroy()
else
script.Parent.CanCollide = false
wait(5)
script.Parent.CanCollide = true
end
end
end
script.Parent.Touched:connect(check)


Try that.

By the way, name your variables better!
Report Abuse
icanxlr8 is not online. icanxlr8
Joined: 25 Feb 2009
Total Posts: 3686
12 Jul 2012 11:42 AM
Thanks, it works now!
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
12 Jul 2012 11:43 AM
Yep. Congrats!
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