jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 03:16 PM |
Plyr = game.Players.LocalPlayer.Name Perk = Instance.new("StringValue") script.Parent.MouseButton1Down:connect(function(Mouse) Perk.Name = Plyr .."Perk" Perk.Value = "Sniper" Perk.Parent = game.Lighting.PlayerPerks wait(0.25) game.Players.LocalPlayer.PlayerGui.PerkGui:remove() end)
That's the code thus far. It works as is. But I want it to show up only once, and for that to be on entry. ... I have next to no idea how to do that. I think it has to use a function(onEntered) somewhere, but I'm not sure where, and if that's all that I would need.
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 28 Jul 2012 03:26 PM |
But the code inside a function connected to this:
game.Players.PlayerEntered:connect(yourFunction)
Time to update this siggy, to this: ! |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 03:28 PM |
Alright. Thanks. =P
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 03:29 PM |
Like this?
game.Players.PlayerEntered:connect(yourFunction) function(yourFunction) -- Specifically here. Plyr = LocalPlayer.Name Perk = Instance.new("StringValue") script.Parent.MouseButton1Down:connect(function(Mouse) Perk.Name = Plyr .."Perk" Perk.Value = "Sniper" Perk.Parent = game.Lighting.PlayerPerks wait(0.25) game.Players.LocalPlayer.PlayerGui.PerkGui:remove() end)
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 28 Jul 2012 04:18 PM |
Put the event below the function.
Also, it would be:
function yourFunction(Plyr)
Time to update this siggy, to this: ! |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 04:21 PM |
Ah. Alright, thanks, again. Lol.
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 04:22 PM |
So... This, then?
function sniperFunction(Plyr) Plyr = game.Players.LocalPlayer.Name Perk = Instance.new("StringValue") script.Parent.MouseButton1Down:connect(function(Mouse) Perk.Name = Plyr .."Perk" Perk.Value = "Sniper" Perk.Parent = game.Lighting.PlayerPerks wait(0.25) game.Players.LocalPlayer.PlayerGui.PerkGui:remove() end)
game.Players.PlayerEntered:connect(sniperFunction) end
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2012 04:54 PM |
@jacob: You can't use "Plyr" twice. Also, Plyr is the Player, so you could just use Plyr.Name. |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2012 04:57 PM |
function sniperFunction(Plyr) Plyr_Name = Plyr.Name Perk = Instance.new("StringValue") script.Parent.MouseButton1Down:connect(function(Mouse) Perk.Name = Plyr_Name .."Perk" Perk.Value = "Sniper" Perk.Parent = game.Lighting.PlayerPerks wait(0.25) Plyr.PlayerGui.PerkGui:remove() end)
game.Players.PlayerEntered:connect(sniperFunction) end |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 04:57 PM |
Why am I unable to use it twice?
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2012 04:58 PM |
| You are able to, but it would be unwise, as Plyr already has the value of game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 04:59 PM |
Ah.
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 05:03 PM |
@Trap; the script isn't working.
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2012 05:05 PM |
function sniperFunction(Plyr) PlyrName = Plyr.Name Perk = Instance.new("StringValue") script.Parent.MouseButton1Down:connect(function(Mouse) Perk.Name = PlyrName .."Perk" Perk.Value = "Sniper" Perk.Parent = game.Lighting.PlayerPerks wait(0.25) Plyr.PlayerGui.PerkGui:Destroy () end) end game.Players.PlayerAdded:connect(sniperFunction)
|
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 05:08 PM |
@Bob; Neither did that.
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 05:09 PM |
Grammatical failure. Nor did*
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 28 Jul 2012 10:22 PM |
Why do you have an this at the end?
end) end
Completely unneeded.
Just remove the end) and it should be fine...
Time to update this siggy, to this: ! |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2012 10:32 PM |
Don't listen to DX, he doesn't know what he is talking about
function sniperFunction(Plyr) Plyr = game.Players.LocalPlayer.Name Perk = Instance.new("StringValue") script.Parent.MouseButton1Down:connect(function(Mouse) Perk.Name = Plyr .."Perk" Perk.Value = "Sniper" Perk.Parent = game.Lighting.PlayerPerks wait(0.25) game.Players.LocalPlayer.PlayerGui.PerkGui:Destroy() end) |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2012 10:32 PM |
| @DX if you are using an anonymous function, you need ) on the end to close off the function start. |
|
|
| Report Abuse |
|
|
DXPower
|
  |
| Joined: 21 Oct 2008 |
| Total Posts: 2866 |
|
|
| 28 Jul 2012 10:46 PM |
That isn't an anomynous function.... Don't you see the function is classified at the top? Don't be saying stuff about people you don't know a thing about, because I do know what I am talking about.
function sniperFunction(Plyr) --See that? That isn't an anonymous function, it is defined. Plyr = game.Players.LocalPlayer.Name Perk = Instance.new("StringValue") script.Parent.MouseButton1Down:connect(function(Mouse) --I missed this the first time around. Perk.Name = Plyr .."Perk" Perk.Value = "Sniper" Perk.Parent = game.Lighting.PlayerPerks wait(0.25) game.Players.LocalPlayer.PlayerGui.PerkGui:Destroy() end) end
game.Players.PlayerAdded:connect(sniperFunction) --Happy?
(Also, indents are hard to see on the forums, so I missed the button event the first time. Also, you removed an end... Sorry for that mistake.)
Don't go saying things about people you have no idea about, wont get you very far in life, and just to let you know, I am a really advanced scripter and I know 7 different languages, so you can shut your mouth I don't know what I am talking about, I missed a line of code because the forums removes indents, mistakes happen.
As to the OP, everything in the function should be fixed. Problem solved.
Time to update this siggy, to this: ! |
|
|
| Report Abuse |
|
|
jacob726
|
  |
| Joined: 24 Jul 2008 |
| Total Posts: 10732 |
|
|
| 28 Jul 2012 10:54 PM |
Alright, then. I'll test it in a few, as is, ?I just sliced my index finger on my dominant hand open, and it is very uncomfortable to click properly.
~>"Those who are allowed to shoot are those who are prepared to be shot."<~ |
|
|
| Report Abuse |
|
|