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 » Scripters
Home Search
 

Re: I need help please! (not that hard)

Previous Thread :: Next Thread 
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 05:04 PM
Ok, I have a round based game, how do I award people in game money if they survive and none if they don't? Please help!

Like I know I need to type something like this...

if survive then
Money = Money + 5
end

But how do I define survive?

----------------------------------------------------------------------------------------------------


ajloni Current RAP: 6,219
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 05:06 PM
Have a value for the character somewhere and if they die then put false they didn't survive.

Use died event on humanoid.
Report Abuse
ImVortexe is not online. ImVortexe
Joined: 26 Jan 2013
Total Posts: 1149
03 Jan 2017 05:09 PM
I think, putting an object around the minigame/round map would be a good idea. This way you can detect how many humanoids are alive. If it finds 1 left, it will identify the persons username and will give them money. Im bad at explaining :P


Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 05:11 PM
My idea is better, and much easier. >.>
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 05:13 PM
i am new to scripting, how do I use a die event?


ajloni Current RAP: 6,214
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 05:20 PM
path to character then this:

Character.Humanoid.Died:connect(function()
-script
end)
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 05:23 PM
ok thanks!


ajloni Current RAP: 6,214
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 05:30 PM
wait but how exactly do I connect that function to my script (shown below)

local h = Instance.new("StringValue",game.ReplicatedStorage)
local d = game.Workspace.Space

h.Name = "MapChanged"
local maps = game.Lighting.Maps:GetChildren()
while true do
if game.Players.NumPlayers >= 0 then
for i = 20, 1, -1 do
h.Value = "Intermission: " ..i..#####conds"

wait(1)
end
h.Value = "Choosing Map..."
wait(3)

local randomMap = math.random(1, #maps)
local mapChosen = maps[randomMap]
local mapChosen = maps[randomMap]
h.Value = "Map Chosen: " ..mapChosen.Name
wait(3)
local mapChosenClone = mapChosen:Clone()
mapChosenClone.Parent = game.Workspace
if mapChosenClone.Name == "Daydream Park" then
d.Parent = game.Lighting


end
target = CFrame.new(263.784, 8.049, -44.6) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
--Make sure the character exists and its HumanoidRootPart exists
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
--add an offset of 5 for each character
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end

for i = 70, 1, -1 do
h.Value = "Tsunami in progress!"

wait(1)
end
h.Value = "The Game Has Ended!"
wait(1.5)
local survive = true





if survive == true then
Money = Money + 20
end
d.Parent = game.Workspace
mapChosenClone:Destroy()
h.Value = "The Game Has Ended!"
wait(1.5)
else
h.Value = "ERROR"

end
wait(.1)
end


ajloni Current RAP: 6,214
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 05:33 PM
Is this a server script?
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 05:33 PM
wait but how exactly do I connect that function to my script (shown below)

local h = Instance.new("StringValue",game.ReplicatedStorage)
local d = game.Workspace.Space

h.Name = "MapChanged"
local maps = game.Lighting.Maps:GetChildren()
while true do
if game.Players.NumPlayers >= 0 then
for i = 20, 1, -1 do
h.Value = "Intermission: " ..i..#####conds"

wait(1)
end
h.Value = "Choosing Map..."
wait(3)

local randomMap = math.random(1, #maps)
local mapChosen = maps[randomMap]
local mapChosen = maps[randomMap]
h.Value = "Map Chosen: " ..mapChosen.Name
wait(3)
local mapChosenClone = mapChosen:Clone()
mapChosenClone.Parent = game.Workspace
if mapChosenClone.Name == "Daydream Park" then
d.Parent = game.Lighting


end
target = CFrame.new(263.784, 8.049, -44.6) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
--Make sure the character exists and its HumanoidRootPart exists
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
--add an offset of 5 for each character
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end

for i = 70, 1, -1 do
h.Value = "Tsunami in progress!"

wait(1)
end
h.Value = "The Game Has Ended!"
wait(1.5)
local survive = true





if survive == true then
Money = Money + 20
end
d.Parent = game.Workspace
mapChosenClone:Destroy()
h.Value = "The Game Has Ended!"
wait(1.5)
else
h.Value = "ERROR"

end
wait(.1)
end


ajloni Current RAP: 6,239
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 05:34 PM
yeah

(and sorry for the extra copy of the script because I thought the reply didnt actually process thru)


ajloni Current RAP: 6,239
Report Abuse
memorycode is not online. memorycode
Joined: 24 Sep 2011
Total Posts: 3322
03 Jan 2017 05:39 PM
keep a dictionary of everybody in the round

local PlayerStatus = {}

for _,v in next, game.Players:GetChildren() do
PlayerStatus[v.Name] = true
StatusConnection = v.CharacterAdded:Connect(function(char)
char.Humanoid.Died:Connect(function()
PlayerStatus[v.Name] = false
StatusConnection:Disconnect()
end)
end)
end




Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 05:45 PM
how do i keep a dictionary of every1? i tried the script and it dosent work


ajloni Current RAP: 6,242
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 05:50 PM
If it's not a local script then do this.
Put this script in everyone's backpack when they start.

script.Parent.Parent.Character.Humanoid.Died:connect(function()
game.ServerStorage.Survivors[script.Parent.Parent.Name].Value = false
end)

______________________


Put another script in serverscriptservices and type this in it:

wait()

folder = Instance.new("Folder")
folder.Parent = game.ServerStorage
folder.Name = "Survivors"

game.Players.PlayerAdded:connect(function(plr)
wait()
x = Instance.new("BoolValue")
x.Parent = game.ServerStorage.Survivors
x.Name = plr.Name
x.Value = false
end)

game.Players.PlayerRemoving:connect(function(player)
wait()
if game.ServerStorage.Survivors:findFirstChild(player.Name) ~= nil then
game.ServerStorage.Survivors[player.Name]:remove()
end
end)
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 05:53 PM
local h = Instance.new("StringValue",game.ReplicatedStorage)
local d = game.Workspace.Space

h.Name = "MapChanged"
local maps = game.Lighting.Maps:GetChildren()
while true do
if game.Players.NumPlayers >= 0 then
for i = 20, 1, -1 do
h.Value = "Intermission: " ..i..#####conds"

wait(1)
end
h.Value = "Choosing Map..."
wait(3)

local randomMap = math.random(1, #maps)
local mapChosen = maps[randomMap]
local mapChosen = maps[randomMap]
h.Value = "Map Chosen: " ..mapChosen.Name
wait(3)
local mapChosenClone = mapChosen:Clone()
mapChosenClone.Parent = game.Workspace
if mapChosenClone.Name == "Daydream Park" then
d.Parent = game.Lighting


end
target = CFrame.new(263.784, 8.049, -44.6) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
--Make sure the character exists and its HumanoidRootPart exists
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
--add an offset of 5 for each character
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
end
end

for i = 70, 1, -1 do
h.Value = "Tsunami in progress!"

wait(1)
end
h.Value = "The Game Has Ended!"
wait(1.5)
local survive = true




for i,v in pairs(game.ServerStorage.Survivors:GetChildren()) do
if v.Value == true then
Money = Money + 20
v.Value = false
end
end
d.Parent = game.Workspace
mapChosenClone:Destroy()
h.Value = "The Game Has Ended!"
wait(1.5)
else
h.Value = "ERROR"

end
wait(.1)
end
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 06:00 PM
Ok, for the main script I put this:
local h = Instance.new("StringValue",game.ReplicatedStorage)
local d = game.Workspace.Space

h.Name = "MapChanged"
local maps = game.Lighting.Maps:GetChildren()
while true do
if game.Players.NumPlayers >= 0 then
for i = 20, 1, -1 do
h.Value = "Intermission: " ..##### Seconds"

wait(1)
end
h.Value = "Choosing Map..."
wait(3)

local randomMap = math.random(1, #maps)
local mapChosen = maps[randomMap]
local mapChosen = maps[randomMap]
h.Value = "Map Chosen: " ..mapChosen.Name
wait(3)
local mapChosenClone = mapChosen:Clone()
mapChosenClone.Parent = game.Workspace
if mapChosenClone.Name == "Daydream Park" then
d.Parent = game.Lighting


end
target = CFrame.new(263.784, 8.049, -44.6) --could be near a brick or in a new area
for i, player in ipairs(game.Players:GetChildren()) do
--Make sure the character exists and its HumanoidRootPart exists
if player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
--add an offset of 5 for each character
player.Character.HumanoidRootPart.CFrame = target + Vector3.new(0, i * 5, 0)
game.Workspace.PlrScript.Parent = game.Players:GetChildren().Backpack


end
end

for i = 70, 1, -1 do
h.Value = "Tsunami in progress!"

wait(1)
end
h.Value = "The Game Has Ended!"
wait(1.5)

local PlayerStatus = {}

for _,v in next, game.Players:GetChildren() do
PlayerStatus[v.Name] = true
StatusConnection = v.CharacterAdded:Connect(function(char)
char.Humanoid.Died:Connect(function()
PlayerStatus[v.Name] = false
StatusConnection:Disconnect()
end)
end)
end




if PlayerStatus == true then
Money = Money + 20
end
d.Parent = game.Workspace
mapChosenClone:Destroy()
h.Value = "The Game Has Ended!"
wait(1.5)
else
h.Value = "ERROR"

end
wait(.1)
end

For the serverscriptservices script I put this:

folder = Instance.new("Folder")
folder.Parent = game.ServerStorage
folder.Name = "Survivors"

game.Players.PlayerAdded:connect(function(plr)
wait()
x = Instance.new("BoolValue")
x.Parent = game.ServerStorage.Survivors
x.Name = plr.Name
x.Value = false
end)

game.Players.PlayerRemoving:connect(function(player)
wait()
if game.ServerStorage.Survivors:findFirstChild(player.Name) ~= nil then
game.ServerStorage.Survivors[player.Name]:remove()
end
end)

And for the other script thats in workspace now, (that in the main script will transfer to the backpack) I put this:

script.Parent.Parent.Character.Humanoid.Died:connect(function()
game.ServerStorage.Survivors[script.Parent.Parent.Name].Value = false
end)

By the way I appreciate your help a lot. Not a lot of people would help someone into this level for free, and to that I say thank you.





ajloni Current RAP: 6,199
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 06:03 PM
Did it work?
Also for future reference don't put server scripts in workspace put it in serverscriptservice
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 06:04 PM
no


ajloni Current RAP: 6,199
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 06:04 PM
but only in rblx studio let me try in the actual roblox launcher thingy ma jingy


ajloni Current RAP: 6,199
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 06:07 PM
ok no it didnt work


ajloni Current RAP: 6,199
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 06:11 PM
wait i am fixing sum things



ajloni Current RAP: 6,199
Report Abuse
TsunaSenpai is not online. TsunaSenpai
Joined: 19 Jul 2012
Total Posts: 685
03 Jan 2017 06:11 PM
Where is the money value located?
Also you didn't copy the main script i fixed, and fix that hashtag in the mainscript.
Report Abuse
Zarkonan_Zenheart is not online. Zarkonan_Zenheart
Joined: 29 May 2012
Total Posts: 610
03 Jan 2017 06:12 PM
or just have a value inside the character when the game starts
when the game ends check if value is present (if you die it clears the character)
if value is present then awardcash() else end
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 06:13 PM
k no it dont work



ajloni Current RAP: 0
Report Abuse
ajloni is not online. ajloni
Joined: 30 Aug 2015
Total Posts: 108
03 Jan 2017 06:15 PM
the money is located at game.Players.theplayersuser.leaderstats.Money



ajloni Current RAP: 6,199
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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