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
|
  |
| 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
|
  |
| Joined: 25 Feb 2009 |
| Total Posts: 3686 |
|
| |
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|