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: Help asap please

Previous Thread :: Next Thread 
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
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 is not online. 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
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 03:12 AM
no errors in output
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 04:39 AM
bump
Report Abuse
vlekje513 is not online. 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
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 04:57 AM
Yes you did.
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 07:18 AM
bump
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 08:12 AM
bump
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 09:54 AM
still need help
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 10:32 AM
help please.
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 11:16 AM
come on guys
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 07:40 PM
still need help
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 08:17 PM
surely someone can help
Report Abuse
Geomaster is not online. 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
thermonuklear is not online. thermonuklear
Joined: 19 Oct 2014
Total Posts: 484
20 Oct 2014 08:21 PM
^
agreed
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
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
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 09:55 PM
still need help
Report Abuse
noah is not online. noah
Joined: 11 Sep 2006
Total Posts: 18977
20 Oct 2014 09:58 PM
Where's Alliance?
Report Abuse
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 10:10 PM
It's a model under game.players.playername
Report Abuse
noah is not online. 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
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
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
SimpleSanta is not online. SimpleSanta
Joined: 02 Dec 2006
Total Posts: 2976
20 Oct 2014 10:33 PM
Thank you Noah! You are amazing, I modified it a bit and it is working.
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