[ad_1]
Recreation Improvement Stack Alternate is a query and reply website for skilled and impartial recreation builders. It solely takes a minute to enroll.
Anyone can ask a query
Anyone can reply
The very best solutions are voted up and rise to the highest
Requested
Considered
66 occasions
I am engaged on a Roblox tycoon recreation. I do not know easy methods to enable the participant to purchase issues as a result of simply utilizing: if tycoonPlayerMoney.Worth >= 10 then
. does not work.
This is the script:
CurrencyName = "Cash" --Title of the forex
StarterValue = 300 -- How a lot cash You begin with
--------------------------------Variables---------------------
v = script.Mum or dad.Values.OwnerValue
m1 = recreation.ReplicatedStorage.Mosques.Mosque1 --- Constructing of the tycoon
b = script.Mum or dad.b --- Buy Buttons
PayOut = 2 -- Quantity of pay
WaitBetweenPayout = 10 -- How lengthy it can take for the following pay
--After touching tycoon door
script.Mum or dad.Touched:Join(perform(Hit)
---Make proprietor
if Hit.Mum or dad:FindFirstChild("Humanoid") and v.Worth == nil then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
v.Worth = Participant
script.Mum or dad.Transparency = 1 -- Door clear
script.Mum or dad.CanCollide = false -- Door CanCollide off
script.Mum or dad.SurfaceGui.TextLabel.Textual content = tostring(v.Worth).."'s Mosque" --Change Door Textual content
native Repeat = true --Repeat giving currrency
native fold = Occasion.new("Folder", Participant) ----Foreign money
fold.Title = "leaderstats"
tycoonPlayerMoney = Occasion.new("IntValue", fold)
tycoonPlayerMoney.Title = CurrencyName
tycoonPlayerMoney.Worth = StarterValue
whereas true do ---Repeat paying each 10 seconds
wait()
if Repeat == true then
wait(WaitBetweenPayout)
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth+PayOut
finish
finish
-----Buy Buttons
b.a.Touched:join(perform(Hit)
if Hit.Mum or dad:FindFirstChild("Humanoid") then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
if v.Worth == Participant and tycoonPlayerMoney.Worth >= 10 then -- How a lot price
m1.Mosq.Decorations.Outdoors.Stairs:Clone()
m1.Mosq.Decorations.Outdoors.Stairs.Mum or dad = workspace.Mosques.mosque1
b.a:Destroy()
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth - 10
PayOut = PayOut + 2
b.b.CanCollide = true
b.b.CanTouch = true
b.b.Transparency = 0
b.b.BillboardGui.Enabled = true --Gui that reveals the worth and title
finish
finish
finish)
b.b.Touched:join(perform(Hit)
if Hit.Mum or dad:FindFirstChild("Humanoid") then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
if v.Worth == Participant and tycoonPlayerMoney.Worth >= 25 then
m1.Mosq.Decorations.Outdoors.Signal:Clone()
m1.Mosq.Decorations.Outdoors.Signal.Mum or dad = workspace.Mosques.mosque1
b.b:Destroy()
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth - 25
PayOut = PayOut + 4
b.c.CanCollide = true
b.c.CanTouch = true
b.c.Transparency = 0
b.c.BillboardGui.Enabled = true
finish
finish
finish)
b.c.Touched:join(perform(Hit)
if Hit.Mum or dad:FindFirstChild("Humanoid") then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
if v.Worth == Participant and tycoonPlayerMoney.Worth >= 45 then
m1.Mosq.WallsEtc.Roofnfloor.FloorF:Clone()
m1.Mosq.WallsEtc.Roofnfloor.FloorF.Mum or dad = workspace.Mosques.mosque1
b.c:Destroy()
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth - 45
PayOut = PayOut + 4
b.d.CanCollide = true
b.d.CanTouch = true
b.d.Transparency = 0
b.d.BillboardGui.Enabled = true
b.d.Touched:join(perform(Hit)
b.d.Touched:join(perform(Hit)
if Hit.Mum or dad:FindFirstChild("Humanoid") then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
if v.Worth == Participant and tycoonPlayerMoney.Worth >= 25 then
m1.Mosq.WallsEtc.WallParts.WallPart1:Clone()
m1.Mosq.WallsEtc.WallParts.WallPart1.Mum or dad = workspace.Mosques.mosque1
b.d:Destroy()
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth - 25
PayOut = PayOut + 2
b.e.CanCollide = true
b.e.CanTouch = true
b.e.Transparency = 0
b.e.BillboardGui.Enabled = true
finish
finish
finish)
b.e.Touched:join(perform(Hit)
if Hit.Mum or dad:FindFirstChild("Humanoid") then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
if v.Worth == Participant and tycoonPlayerMoney.Worth >= 25 then
m1.Mosq.WallsEtc.WallParts.WallPart2:Clone()
m1.Mosq.WallsEtc.WallParts.WallPart2.Mum or dad = workspace.Mosques.mosque1
b.e:Destroy()
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth - 25
PayOut = PayOut + 2
b.f.CanCollide = true
b.f.CanTouch = true
b.f.Transparency = 0
b.f.BillboardGui.Enabled = true
finish
finish
finish)
b.f.Touched:join(perform(Hit)
if Hit.Mum or dad:FindFirstChild("Humanoid") then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
if v.Worth == Participant and tycoonPlayerMoney.Worth >= 125 then
m1.Mosq.WallsEtc.Partitions.EtcRoom.Wall1:Clone()
m1.Mosq.WallsEtc.Partitions.EtcRoom.Wall1.Mum or dad = workspace.Mosques.mosque1
b.f:Destroy()
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth - 125
PayOut = PayOut + 6
b.g.CanCollide = true
b.g.CanTouch = true
b.g.Transparency = 0
b.g.BillboardGui.Enabled = true
finish
finish
finish)
b.g.Touched:join(perform(Hit)
if Hit.Mum or dad:FindFirstChild("Humanoid") then
native Participant = recreation.Gamers:GetPlayerFromCharacter(Hit.Mum or dad)
if v.Worth == Participant and tycoonPlayerMoney.Worth >= 45 then
m1.Mosq.WallsEtc.Partitions.EtcRoom.Wall2:Clone()
m1.Mosq.WallsEtc.Partitions.EtcRoom.Wall2.Mum or dad = workspace.Mosques.mosque1
b.g:Destroy()
tycoonPlayerMoney.Worth = tycoonPlayerMoney.Worth - 45
PayOut = PayOut + 4
finish
finish
finish)
finish)
finish
finish
finish)
finish
finish)
```
$endgroup$
1
default
[ad_2]