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: SCRIPTING, IN NEED OF SERIOUS HELP

Previous Thread :: Next Thread 
MattTheAttack is not online. MattTheAttack
Joined: 25 Mar 2012
Total Posts: 54
20 Dec 2013 03:04 PM
Whats wrong with this script? I want it to teleport two random players in the fighting ring :( Please helppp!!! Here

--Sword duel tournament scripting, by Andyhappy625--

local m = Instance.new("Message")
m.Text = "Welcome to the Sharks Den fighting Areana!"
local eventrunning = false
local deb = false

function onChatted(msg, recipient, speaker)

local source = string.lower(speaker.Name)
msg = string.lower(msg)

if (msg == "spectate") then
speaker.Status.Value = 0
local n = Instance.new("Message")
n.Parent = speaker
n.Text = "Now spectating."
wait(1.5)
n:remove()
end
if (msg == "play") then
speaker.Status.Value = 1
local n = Instance.new("Message")
n.Parent = speaker
n.Text = "Let the duel begin!"
wait(1.5)
n:remove()
end

if (msg == "start") and (deb == false) then

local players = game.Players:getChildren()
local competitors = 0
for i = 1, #players do
if players[i].Character ~= nil then
if players[i].Status.Value == 1 then
competitors = competitors + 1
end
end
end

---We have to make this a COMPETITION. Not a "sit here, get points" place.
if competitors >= 2 then

deb = true

wait(1)
m.Parent = game.Workspace
wait(3)
m.Text = "Let the battles begin!"
wait(1)

---First event down, now on to Fencing.-------------------------------------

local players = game.Players:getChildren()
local remaining = {}

for i = 1, #players do
if players[i].Character ~= nil then
if players[i].Status.Value == 1 then
players[i].Character.Humanoid.Jump = true
wait(0.1)
players[i].Character:MoveTo(game.Workspace:findFirstChild("Viewing Booth").Position + Vector3.new(math.random(-10, 10), 5, math.random(-10, 10)))
local fr = Instance.new("IntValue")
fr.Name = "FencingRound"
fr.Value = 1
fr.Parent = players[i].Character
local sword = game.Lighting.LinkedSword:clone()
sword.Parent = players[i].Backpack
local ff = Instance.new("ForceField")
ff.Parent = players[i].Character
table.insert(remaining, players[i])
end
end
end

wait(2)
m.Parent = nil

if #remaining >= 2 then eventrunning = true end

local round = 1
for i = 1, #remaining do
print(remaining[i])
end

---------------------------------------------------------------(120 lines)------------Fencing Event Script.
while eventrunning do
------------------------------------------------------------------------Begin A/B combat.
if #remaining >= 2 then
local a = remaining[math.random(1, #remaining)]
local b = remaining[math.random(1, #remaining)]
while a == b do
b = remaining[math.random(1, #remaining)]
wait(0.1)
end

a.Character.Humanoid.Jump = true
b.Character.Humanoid.Jump = true
wait(0.1)
a.Character:MoveTo(game.Workspace.SwordFightA.Position)
b.Character:MoveTo(game.Workspace.SwordFightB.Position)
if a.Character:findFirstChild("ForceField") ~= nil then
a.Character:findFirstChild("ForceField"):remove()
end
if b.Character:findFirstChild("ForceField") ~= nil then
b.Character:findFirstChild("ForceField"):remove()
end

local c = a.Character.Humanoid.Health*b.Character.Humanoid.Health
print(c)

while c ~= 0 do
if a.Character ~= nil and b.Character ~= nil then
c = a.Character.Humanoid.Health*b.Character.Humanoid.Health
elseif (a.Character == nil or b.Character == nil) then
wait(1.3)
c = 0
end
wait(1.3)
end

if a.Character ~= nil then
if a.Character.Humanoid.Health ~= 0 and a.Character:findFirstChild("FencingRound") ~= nil then
a.leaderstats.Points.Value = a.leaderstats.Points.Value + a.Character.FencingRound.Value*10
a.Character.FencingRound.Value = a.Character.FencingRound.Value + 1
m.Text = "" .. a.Name .. " has won the duel!"
m.Parent = game.Workspace
wait(2.5)
a.Character.Humanoid.Jump = true
a.Character.Humanoid.Health = 100
wait(0.5)
local ff = Instance.new("ForceField")
ff.Parent = a.Character
a.Character:MoveTo(game.Workspace:findFirstChild("Viewing Booth").Position + Vector3.new(math.random(-10, 10), 5, math.random(-10, 10)))
m.Parent = nil
end
end
if b.Character ~= nil then
if b.Character.Humanoid.Health ~= 0 and b.Character:findFirstChild("FencingRound") ~= nil then
b.leaderstats.Points.Value = b.leaderstats.Points.Value + b.Character.FencingRound.Value*10
b.Character.FencingRound.Value = b.Character.FencingRound.Value + 1
m.Text = "" .. b.Name .. " has won the duel!"
m.Parent = game.Workspace
wait(2.5)
b.Character.Humanoid.Jump = true
b.Character.Humanoid.Health = 100
wait(0.5)
local ff = Instance.new("ForceField")
ff.Parent = b.Character
b.Character:MoveTo(game.Workspace:findFirstChild("Viewing Booth").Position + Vector3.new(math.random(-10, 10), 5, math.random(-10, 10)))
m.Parent = nil
end
end

end
-------------------------------------------------------------------------End A/B combat
print("Checking...")
wait(3.1) --To make sure we get "FencingRound" out of the dead player...
eventrunning = false
remaining = {}
for i = 1, #players do
if players[i].Character ~= nil then
if players[i].Character:findFirstChild("FencingRound") ~= nil then
if players[i].Character.FencingRound.Value == round then
table.insert(remaining, players[i])
end
end
end
end
----------To check remaining players.
if #remaining >= 2 then
print("2+ players remain.")
eventrunning = true

elseif #remaining == 1 then
print("1 player remains...checking for others.")

for i = 1, #players do
if players[i].Character ~= nil then
if players[i].Character:findFirstChild("FencingRound") ~= nil then
if players[i].Character.FencingRound.Value == round + 1 then
remaining[1].Character.FencingRound.Value = round + 1
round = remaining[1].Character.FencingRound.Value
table.insert(remaining, players[i])
eventrunning = true
end
end
end
end

if eventrunning == false then
m.Text = "" .. remaining[1].Name .. " has won the Sword Tournament!"
m.Parent = game.Workspace
remaining[1].leaderstats.Points.Value = remaining[1].leaderstats.Points.Value + 50
remaining[1].Character:BreakJoints()
wait(3)
m.Parent = nil
end

elseif #remaining == 0 then
print("Must not be any players left at this level...checking next round")
for i = 1, #players do
if players[i].Character ~= nil then
if players[i].Character:findFirstChild("FencingRound") ~= nil then
if players[i].Character.FencingRound.Value == round + 1 then
table.insert(remaining, players[i])
eventrunning = true
end
end
end
end

if eventrunning == true then round = round + 1 end

end----------End remaining check.
---Tournament runs until we have a definitive winner.

end
-------------------------------------------------------------------------------End Fencing Tournament Script.

m.Text = "Congratulations to all who have participated!"
m.Parent = game.Workspace
wait(3)
m.Parent = nil

--------------------------------------------------------------------------------------------------------End of script.

deb = false
m.Text = "Welcome to the Sword Fighting Tournament!"
end
end
end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
20 Dec 2013 03:07 PM
Is there any output? Also, what line teleports the player?

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
MattTheAttack is not online. MattTheAttack
Joined: 25 Mar 2012
Total Posts: 54
20 Dec 2013 03:12 PM
Thats what I think I was missing! Can you please fix this for me? Please? Im about to buy another membership and ill give you some of my limiteds if you could help............
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
20 Dec 2013 03:13 PM
As I asked before, what is the output, and what line teleports the player? Almost nobody here will read through a few hundred lines of code.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
MattTheAttack is not online. MattTheAttack
Joined: 25 Mar 2012
Total Posts: 54
20 Dec 2013 05:49 PM
I dont know, this is way to advanced for me.
Report Abuse
domorox17 is not online. domorox17
Joined: 06 Mar 2012
Total Posts: 1710
20 Dec 2013 05:51 PM
is this made for u? because it clearly says at the top that it is made by someone else. we dont help u edit free models
Report Abuse
Xeleum is not online. Xeleum
Joined: 24 Oct 2010
Total Posts: 3507
20 Dec 2013 05:56 PM
"I dont know, this is way too advanced for me"

Why use it then?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
21 Dec 2013 12:01 PM
I have a simpler solution than expecting us to read through that mass of code; these few pages:
- http://wiki.roblox.com/index.php/MoveTo (Model's method)
- http://wiki.roblox.com/index.php/Math.random
- http://wiki.roblox.com/index.php/GetPlayers
- http://wiki.roblox.com/index.php/Vector3

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
21 Dec 2013 12:14 PM
MoveTo makes the person walk.
Report Abuse
qrrrq is not online. qrrrq
Joined: 27 Jan 2013
Total Posts: 1252
21 Dec 2013 12:16 PM
That's the humanoid's MoveTo.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
21 Dec 2013 12:18 PM
Oh... he's talking about play er moveto nvm
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
22 Dec 2013 10:00 AM
No, I'm talking about Model's method MoveTo (as stated beside the link).
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
23 Dec 2013 03:44 AM
the player is kinda like a model....
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
23 Dec 2013 12:20 PM
The Player is the Player object. The Player's CHARACTER is a Model. However, referring to MoveTo as Player's method would be both incorrect and confusing to people. Even if you're referring to the Player's character, it makes it sound as if MoveTo is not a method of other Models.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
23 Dec 2013 12:28 PM
Btw, you have to MakeJoints for models.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
23 Dec 2013 12:43 PM
You have to make joints after what?

V Finally on computer so I haz my siggy
Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
23 Dec 2013 02:57 PM
IF ITS A MODEL U HAVE TO MAKEJOINTS! D:<
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
24 Dec 2013 11:36 AM
What do you have to MakeJoints after though? I know you usually have to if you've moved it from a null environment, but I don't remember anything concerning MakeJoints and MoveTo.
Report Abuse
KEVEKEV77 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
24 Dec 2013 09:43 PM
well I guess you missed it. D:<
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
24 Dec 2013 09:54 PM
If competetors > 1 then
Code here

Also, to tp the player, just change the torsos cframe
Report Abuse
3rdblox is not online. 3rdblox
Joined: 09 Dec 2012
Total Posts: 4741
24 Dec 2013 10:47 PM
I can't help you with the script, but a bit of advice for asking for help in the future...

Posting a huge wall of code isn't wise if you need an error fixed, very few helpers will read all of it. The output should say [Script's Location]:[Line Number]:[Error]. In future when asking for help you should post the line it happened on, what variables (if any) were used, how they were assigned and what might have changed them plus the output and anything else that might be useful. If no errors appeared in the output but it didn't do what you wanted you should make it print what condition was true after every if, function, ect to try and find the error.

Good luck with your building.
Report Abuse
FreeScriptMaker is not online. FreeScriptMaker
Joined: 29 Nov 2013
Total Posts: 2275
24 Dec 2013 11:04 PM
Nobody is going to read that you have to give more info.
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
24 Dec 2013 11:54 PM
pay4help-pls
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
24 Dec 2013 11:58 PM
>Free Model -_-
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
25 Dec 2013 09:34 AM
@KEVEKEV77
Shame, shame.

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
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