|
| 20 Oct 2014 03:01 AM |
This is supposed to remove a value from your alliances model if you've already got them allied, and to add a value if you aren't already allied, I can't figure out what the problem is, this coding is in a script with this parent structure,
which is script>text button>frame>screengui>playergui>player
function Click() local list = game.Players:getChildren() for i,v in pairs(list) do if v.TeamColor == BrickColor.new("Really blue") then local alliances = script.Parent.Parent.Parent.Parent.Parent:findFirstChild("Alliances") if script.Parent.Parent.Parent.Parent.Parent and v and alliances then if alliances:findFirstChild(v.Name) ~= nil then alliances[v.Name]:remove() local m = Instance.new("Message") m.Parent = script.Parent.Parent.Parent.Parent m.Text = "(script.Parent.Parent.Parent.Parent.Parent.Name, Alliance with .. v.Name .. undone., 8)" m.Text = "(v.Name,script.Parent.Parent.Parent.Parent.Parent.Name .. is no longer your allied., 8)" else local alliance = Instance.new("StringValue") alliance.Name = v.Name alliance.Parent = alliances local m = Instance.new("Message") m.Text = "(player, Alliance with .. targetPlayer.Name .. done., 8)" m.Text = "(targetPlayer, player.Name .. is now your allied., 8)" end end end end end
script.Parent.MouseButton1Down:connect(Click)
|
|
|
| Report Abuse |
|
|
Aurarus
|
  |
| Joined: 22 Dec 2008 |
| Total Posts: 4761 |
|
|
| 20 Oct 2014 03:10 AM |
What does output say?
Also I've never seen that kind of string formatting...
And use :Destroy() instead of :remove()
Remove just sets its parent to nil and doesn't actually remove it from the game. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 20 Oct 2014 04:55 AM |
| I met you in the polish army fort yesterday. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 20 Oct 2014 08:20 PM |
| You really, really, really need to use more variables |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Oct 2014 08:25 PM |
I know :P couldn't be bothered with this as when I was making it I wasn't quite sure where I was going with it.
but in terms of the script, where does the problem lay? |
|
|
| Report Abuse |
|
|
| |
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
| |
|
|
| 20 Oct 2014 10:10 PM |
| It's a model under game.players.playername |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 20 Oct 2014 10:26 PM |
@Simple I dunno.. your script looks like parts of freemodel code..
I tried @below
local Player = game:GetService("Players").LocalPlayer repeat wait() until Player Alliances = Player:FindFirstChild("Alliances")
script.Parent.MouseButton1Down:connect(function() local list = game.Players:getChildren() for i,v in pairs(list) do if v.TeamColor == BrickColor.new("Really blue") then if Player and v and Alliances then if Alliances:findFirstChild(v.Name) ~= nil then Alliances[v.Name]:Destroy() local m = Instance.new("Message") m.Parent = Player.PlayerGui m.Text = Player.Name..", Alliance with "..v.Name.." undone." wait(2) m.Text = v.Name..", "..Player.Name.." is no longer your ally." wait(2) m:Destroy() else local newAlliance = Instance.new("StringValue") newAlliance.Name = v.Name newAlliance.Parent = Alliances local m = Instance.new("Message") m.Text = Player.Name..", Alliance with "..v.Name.." done." m.Text = v.Name..", "..Player.Name.." is now your longer your ally." end end end end end) |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2014 10:27 PM |
Not at all noah! I am just what I like to call a trial and error scripter...
In other words, I don't know what I am doing, I just keep doing things until it works somehow!
|
|
|
| Report Abuse |
|
|
|
| 20 Oct 2014 10:33 PM |
| Thank you Noah! You are amazing, I modified it a bit and it is working. |
|
|
| Report Abuse |
|
|