|
| 25 Nov 2013 02:27 PM |
What im trying to make it do is once this part is touched by one person, everyone gets this GUI. Any help?
gui1 = game.Lighting.CountdownSho gui2 = game.Lighting.VoteGen
local debounce = false
function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
gui1:clone().Parent = player.PlayerGui gui2:clone().Parent = player.PlayerGui game.Workspace.Countdown.s.Disabled = false -- Ignore this wait(60) game.Workspace.Countdown.s.Disabled = true -- and this wait(35) debounce = false end end
game.Workspace.VoteBox1.guifloor.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 25 Nov 2013 02:29 PM |
local players = game.Players:GetChildren() Wouldn't that be correct? |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 25 Nov 2013 02:34 PM |
local players = game.Players:children() for i = 1, #players do
Should be
for k,c in pairs(game.Players:GetChildren()) do |
|
|
| Report Abuse |
|
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 25 Nov 2013 02:42 PM |
gui1 = game.Lighting.CountdownSho gui2 = game.Lighting.VoteGen debounce = false function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then
debounce = true
for i,v in pairs(game.Players:GetPlayers()) do gui1:clone().Parent = v.PlayerGui gui2:clone().Parent = v.PlayerGui game.Workspace.Countdown.s.Disabled = false -- Ignore this wait(60) game.Workspace.Countdown.s.Disabled = true -- and this wait(35) debounce = false end end
game.Workspace.VoteBox1.guifloor.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 25 Nov 2013 02:46 PM |
@smiley - How would that work out though with the rest of the script? It doesnt. If you want to add that in, rewrite the rest of the script so it will work.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Nov 2013 03:19 PM |
@smiley Just got your second response, still wont work though |
|
|
| Report Abuse |
|
|
CrniOrao
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 2274 |
|
|
| 25 Nov 2013 03:20 PM |
function getPlayer(humanoid) local players = game.Players:children() for i = 1, #players do if players[i].Character.Humanoid == humanoid then return players[i] end end return nil end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid") local character = part.Parent local player = game.Players:GetPlayerFromCharacter(character) if (human ~= nil) and player.PlayerGui:findFirstChild("CountDownSho") and player.PlayerGui:findFirstChild("VoteGen") then else return local player = getPlayer(human)
if (player == nil) then return end gui1:clone().Parent = player.PlayerGui gui2:clone().Parent = player.PlayerGui game.Workspace.Countdown.s.Disabled = false -- Ignore this wait(60) game.Workspace.Countdown.s.Disabled = true -- and this wait(35) end end
game.Workspace.VoteBox1.guifloor.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
| |
|
Insainity
|
  |
| Joined: 01 Sep 2013 |
| Total Posts: 3103 |
|
|
| 25 Nov 2013 03:38 PM |
do
local players = game.Players:GetChildren() |
|
|
| Report Abuse |
|
|
| |
|
| |
|
smiley599
|
  |
| Joined: 23 Jan 2010 |
| Total Posts: 21869 |
|
|
| 25 Nov 2013 05:04 PM |
"still wont work though" And why not? The first part of your script is unnecessary; I've implemented it into the whole thing. Try it first and tell me why it's not working so we can fix it. My god.... -_- |
|
|
| Report Abuse |
|
|