|
Could someone help me make these scripts work together? By that i mean the money script/gui money work with this buying script? If you could do this it would be very helpful.
Buying script:
upgradecost = 0 --How much it will cost
dist = 5
--____________________________________________________________
function onClicked()
local p = game.Players:GetChildren()
for i = 1, #p do
local cash = p[i].leaderstats:findFirstChild("Points")
if (p[i].Name ~= script.Owner.Value) then
if cash.Value > upgradecost or cash.Value == upgradecost then
if (p[i].Character.Torso.Position - script.Parent.Position).magnitude < dist then
cash.Value = cash.Value - upgradecost
game.Workspace.door1:remove()
script.Parent.Parent:remove()
end
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Cash gui script:
game.Players.PlayerAdded:connect(function(player)
stat = Instance.new("IntValue")
stat.Name = "leaderstats"
stat.Parent = player
cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Parent = stat
end)
|
|
BLOXLUAJoin Date: 2013-03-16 Post Count: 453 |
No. |
|
|
--Waves magic wand!--
a penny saved is a penny earned but the government will take it anyways |
|
BLOXLUAJoin Date: 2013-03-16 Post Count: 453 |
1) These are Free Modeled, get out.
2) The "cash gui" isn't a cash Gui, get out.
3) Get out. |
|
|
1) Whats wrong with that? I can't make scripts.
2) It adds in a section that says "Cash" and you can add money with a certain script.
3) No. |
|
|
Honestly, you're better off learning LUA as it's more efficient and you can write better scripts than the forums can.
a penny saved is a penny earned but the government will take it anyways |
|
|
I still don't get it. What IS this "LUA" everyone is talking about? I have never heard of it... |
|
BLOXLUAJoin Date: 2013-03-16 Post Count: 453 |
I have no idea what this "LUA" is-- oh wait, maybe it's a new brand of mayonnaise. |
|
|
It could be a car, maybe? |
|
BLOXLUAJoin Date: 2013-03-16 Post Count: 453 |
This kids is why you shouldn't misspell/incorrectly type anything on the ROBLOX Forums (or anywhere on the internet). |
|
fret13103Join Date: 2010-03-15 Post Count: 881 |
You haven't actually said what you want done, you've just shown us a script, that is fine. All it does it open a door @ line 13
maybe this
function onClicked()
local p = game.Players:GetChildren()
for i = 1, #p do
local cash = p[i].leaderstats:findFirstChild("Points")
if (p[i].Name ~= script.Owner.Value) then
if cash.Value > upgradecost or cash.Value == upgradecost then
if (p[i].Character.Torso.Position - script.Parent.Position).magnitude < dist then
cash.Value = cash.Value - upgradecost
WHAT YOU WANT IT TO DO HERE
script.Parent.Parent:remove()
end
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
|
fret13103Join Date: 2010-03-15 Post Count: 881 |
Just put a local Object Value Int inside the player when he spawns, that will be your money, then rewrite the script so that instead of checking money it checks the Int value you have inside your char. Not very hard |
|
|
I don't know how to do that. I was hoping someone could make the script that adds money work with that other script.
Here is the script I got for adding money:
moneyToGive = 100
debounce = false
script.Parent.Touched:connect(function(hit)
if debounce == true then return end
player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player == nil then return end
stat = player:findFirstChild("leaderstats")
if stat == nil then return end
cash = stat:findFirstChild("Cash")
if cash == nil then return end
debounce = true
cash.Value = cash.Value + moneyToGive
wait(2)
debounce = false
end)
|
|
|
|
|
|
local cash = p[i].leaderstats:findFirstChild("Cash")
Lol'd |
|
|
Never mind this blasted game then. No one is has helped me with this besides one person. I've already started making a game in something called Game Maker since barely anyone helped. |
|
|
Yes I can, you forgot this: print(string.sub("Analyics",1,4))
Enjoy ^_^ |
|