|
| 27 Dec 2013 03:09 PM |
Hi! I'm making a place where you have an empire. I'm trying to make a button gui to place a house, but, when i try to put an if it get an error! Script:
local player = script.Parent.Parent.Parent.Parent.Parent local wood = player.leaderstats.Wood local stone = player.leaderstats.Stone script.Parent.BackgroundColor3 = Color3.new(88, 88, 88) function onClicked() if stone >= 50 then HERE local brick = Instance.new("Part", game.Workspace.Buildings) brick.Name = "NewBrick" brick.Size = Vector3.new(1, 1, 1) brick.Position = player.Character.Torso.Position brick.BrickColor = player.TeamColor brick.Archivable = false brick.Anchored = true script.Parent.BackgroundColor3 = Color3.new(0, 0, 170) wait(1) script.Parent.BackgroundColor3 = Color3.new(88, 88, 88) end end script.Parent.MouseButton1Click:connect(onClicked) |
|
|
| Report Abuse |
|
|
Alex4897
|
  |
| Joined: 06 Aug 2008 |
| Total Posts: 14517 |
|
|
| 27 Dec 2013 03:14 PM |
Your wood and stone variables need to be player.leaderstats.(material).Value
Your current script is checking if the object stone itself is above or equal to 50. It needs to check the objects value.
I am an eggspert in the eggcelent art of egg puns. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 03:14 PM |
if stone.Value >= 50 then
.Value is important. |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Dec 2013 03:23 PM |
Now it isn't placing the brick: local player = script.Parent.Parent.Parent.Parent.Parent local wood = player.leaderstats.Wood.Value local stone = player.leaderstats.Stone.Value script.Parent.BackgroundColor3 = Color3.new(88, 88, 88) function onClicked() if stone >= 50 then local brick = Instance.new("Part", game.Workspace.Buildings) brick.Name = "NewBrick" brick.Size = Vector3.new(1, 1, 1) brick.Position = player.Character.Torso.Position brick.BrickColor = player.TeamColor brick.Archivable = false brick.Anchored = true stone = stone - 50 script.Parent.BackgroundColor3 = Color3.new(0, 0, 170) wait(1) script.Parent.BackgroundColor3 = Color3.new(88, 88, 88) else script.Parent.BackgroundColor3 = Color3.new(170, 0, 0) wait(1) script.Parent.BackgroundColor3 = Color3.new(88, 88, 88) end end script.Parent.MouseButton1Click:connect(onClicked) |
|
|
| Report Abuse |
|
|
Alex4897
|
  |
| Joined: 06 Aug 2008 |
| Total Posts: 14517 |
|
|
| 27 Dec 2013 03:24 PM |
Do you know where the specific error is?
I am an eggspert in the eggcelent art of egg puns. |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 03:48 PM |
| No, i think is because the if! If i remove the if i can place the brick! |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 03:53 PM |
Here is my leaderboard (With stone) game.Players.PlayerAdded:connect(function(player) -- Leaderstats: local leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" -- Tools: local lumbertool = Instance.new("BoolValue", player) lumbertool.Name = "lumbertool" local minertool = Instance.new("BoolValue", player) minertool.Name = "minertool" -- Items/Score: local wood = Instance.new("IntValue", leaderstats) wood.Name = "Wood" wood.Value = 25 local stone = Instance.new("IntValue", leaderstats) stone.Name = "Stone" stone.Value = 25 local maxpopulation = Instance.new("IntValue", leaderstats) maxpopulation.Name = "MaxPopulation" maxpopulation.Value = 3 local population = Instance.new("IntValue", leaderstats) population.Name = "Population" population.Value = 0 end) |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2013 03:59 PM |
Go to my place to seed what is happening! I already have send a friend request. http://www.roblox.com/Empire-Age-Closed-Alpha-V0-03-place?id=140004774 |
|
|
| Report Abuse |
|
|