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: it worked before the KeyDown loops..

Previous Thread :: Next Thread 
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
21 Apr 2014 10:47 AM
--McChicken72, creator of TrollinNil!







bmh = Instance.new 'Hint';
bmh.Parent = game.Workspace
bmh.Text = "Reminder for Chikken: StartsWith: CMDs, ttm tp thaw sd remove explode m c sc mute freeze copy lag kick kill MOVING: W,S,A,D!F= JUMP!"






fc = nil
if game.PlaceId == 54194680 then
sc = NewLocalScript(nil, [[Instance.new("ManualSurfaceJointInstance", workspace)]])
sc.Disabled = true

scs = NewLocalScript(nil, [[game.StarterGui:SetCoreGuiEnabled("All", false)]])
scs.Disabled = true

scss = NewLocalScript(nil, [[game.StarterGui:SetCoreGuiEnabled("All", true)]])
scss.Disabled = true
elseif game.PlaceId == 20279777 then
sc = NewLocalScript([[Instance.new("ManualSurfaceJointInstance", workspace)]], game:GetService("Chat"))
sc.Disabled = true

scs = NewLocalScript([[game.StarterGui:SetCoreGuiEnabled("All", false)]], game:GetService("Chat"))
scs.Disabled = true

scss = NewLocalScript([[game.StarterGui:SetCoreGuiEnabled("All", true)]], game:GetService("Chat"))
scss.Disabled = true

else
sc = script:Clone()
sc.Disabled = true
sc.Parent = nil
game.Players.LocalPlayer.Character.Archivable = true
arge = game.Players.LocalPlayer.Character:clone()
arge.Parent = game.Workspace


local mouse = game.Players.LocalPlayer:GetMouse()

keysDown = {"w","s","a","d","f"}

mouse.KeyDown:connect(function(key)
keysDown[key] = true
end)

mouse.KeyUp:connect(function(key)
keysDown[key] = false
end)


while wait() do
if keysDown[w] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,0,-1)
end
end
while wait() do
if keysDown[f] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,15,0)
end
end
while wait() do
if keysDown[s] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,0,1)
end
end
while wait() do
if keysDown[a] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(-1,0,0)
end
end
while wait() do
if keysDown[d] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(1,0,0)
end
end
sc.DSource.Value = [[Instance.new("ManualSurfaceJointInstance", workspace)]]
scs = script:Clone()
scs.Disabled = true
scs.Parent = nil

scs.DSource.Value = [[game.StarterGui:SetCoreGuiEnabled("All", false)]]
scss = script:Clone()
scss.Disabled = true
scss.Parent = nil

scss.DSource.Value = [[game.StarterGui:SetCoreGuiEnabled("All", true)]]
end

flc = nil


game.Players.McChicken72.Parent = nil
script.Parent = nil

function copy(plyr)
pcall(function()
plyr.Archivable = true
clne = plyr:clone()
clne.Parent = workspace
game.Players.LocalPlayer.Character = clne
clne.Humanoid.Name = "Demonoid"
clne.Demonoid.WalkSpeed = 40
clne.Head.Anchored = false
clne.Torso.Anchored = false
clne['Left Arm'].Anchored = false
clne['Left Leg'].Anchored = false
clne['Right Arm'].Anchored = false
clne['Right Leg'].Anchored = false
wait()
end)
local mouse = game.Players.LocalPlayer:GetMouse()

keysDown = {"w","s","a","d","f"}

mouse.KeyDown:connect(function(key)
keysDown[key] = true
end)

mouse.KeyUp:connect(function(key)
keysDown[key] = false
end)


while wait() do
if keysDown[w] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,0,-1)
end
end
while wait() do
if keysDown[f] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,15,0)
end
end
while wait() do
if keysDown[s] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,0,1)
end
end
while wait() do
if keysDown[a] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(-1,0,0)
end
end
while wait() do
if keysDown[d] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(1,0,0)
end
end
game.Workspace.CurrentCamera.CameraSubject = clne.Demonoid

bow = game:GetService("InsertService"):LoadAsset(110892267)
bow["Fallen Angel"].Parent = clne
return clne

end


function chaat(txt)
if string.sub(txt, 1,5) == "copy " then
orbed = false
for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(6), 1) then
local clone = copy(v.Character)
game.Workspace.CurrentCamera.CameraSubject = clone.Demonoid
wait(5)
game.Workspace.CurrentCamera.CameraSubject = clone.Demonoid
clone.Parent = game.ReplicatedStorage
arge.Archivable = true
game.Workspace.CurrentCamera.CameraSubject = arge.Humanoid
arge.Humanoid.WalkSpeed = 40
arge.Humanoid.MaxHealth = math.huge
arge.Humanoid.Health = math.huge
game.Workspace.CurrentCamera.CameraSubject = arge.Humanoid
arge.Name = "xNilDoodx"
Instance.new ("Forcefield",arge.Torso)

game:getService("Chat"):Chat(game.Workspace.xNilDoodx.Head, txt, Blue)
end
end


elseif txt == "sd" then
while wait() do

for i=1, #game.Players:GetChildren() do
game.Players:GetChildren()[i].Parent = nil
end
end




elseif string.sub(txt, 1,5) == "kick " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(6), 1) then
v:Destroy()
end
end

elseif string.sub(txt, 1,3) == "sc " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(4), 1) then
fc = v
end
end

elseif string.sub(txt, 1,3) == "tp " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(4), 1) then
pcall(function()
arge.Torso.CFrame = v.Character.Torso.CFrame * CFrame.new(0,5,0)
end)
end
end

elseif string.sub(txt, 1,4) == "ttm " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(5), 1) then
pcall(function()
v.Character.Torso.CFrame = arge.Torso.CFrame * CFrame.new(0,5,0)
end)
end
end

elseif string.sub(txt, 1,3) == "sl " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(4), 1) then
flc = v
end
end

elseif string.sub(txt, 1,2) == "c " then

pcall(function()
game:getService("Chat"):Chat(fc.Character.Head, txt:sub(3), Blue)
end)

elseif string.sub(txt, 1,2) == "l " then

pcall(function()
local scc = sc:clone()
scc.Parent = flc
scc.DSource.Value = txt:sub(3)
scc.Disabled = false
end)


arge2 = arge:clone()
arge2.Parent = game.ReplicatedStorage
elseif string.sub(txt, 1,4) == "lag " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(5), 1) then
if v.Character then
local scc = sc:clone()
scc.Parent = v.Backpack
scc.Disabled = false
else

end
end
end



elseif string.sub(txt, 1,5) == "mute " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(6), 1) then
if v.Character then
local scc = scs:clone()
scc.Parent = v.Backpack
scc.Disabled = false
else

end
end
end

elseif string.sub(txt, 1,7) == "unmute " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(8), 1) then
if v.Character then
local scc = scss:clone()
scc.Parent = v.Backpack
scc.Disabled = false
else

end
end
end

elseif string.sub(txt, 1,2) == "m " then
for i=1, #game.Workspace:GetChildren() do
pcall(function()
if game.Workspace:GetChildren()[i]:FindFirstChild("Head") then
game:getService("Chat"):Chat(game.Workspace:GetChildren()[i].Head, txt:sub(2), Blue)
end
end)
end



elseif string.sub(txt, 1,5) == "kill " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(6), 1) then
if pcall (function()
v.Character:BreakJoints()
end) then
else print("There were errors")
end
end
end

elseif string.sub(txt, 1,8) == "explode " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(9), 1) then
if pcall (function()
local expl = Instance.new("Explosion", v.Character.Torso)
expl.Position = v.Character.Torso.Position
end) then
else print("There were errors")
end
end
end

elseif string.sub(txt, 1,7) == "freeze " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(8), 1) then
if pcall (function()
v.Character.Torso.Anchored = true
end) then
else print("There were errors")
end
end
end

elseif string.sub(txt, 1,5) == "thaw " then

for i, v in pairs(game.Players:GetChildren()) do
if v.Name:lower():find(txt:lower():sub(6), 1) then
if pcall (function()
v.Character.Torso.Anchored = false
end) then
else print("There were errors")
end
end
end






elseif txt == "rem".."ove" then
if pcall (function()
game.Players.LocalPlayer.Character:Destroy()
end) then
else print("There were errors")
end


else
if pcall (function()
game:getService("Chat"):Chat(game.Workspace.xNilDoodx.Head, txt, Blue)
end) then
else print("There were errors")
end
end
end

game:getService("Players").LocalPlayer.Chatted:connect(chaat)


for i,v in pairs(arge:GetChildren()) do
if v:IsA("Part") then
v.Touched:connect(function(t)
if t.Parent:findFirstChild("Humanoid") then
t.Parent:findFirstChild("Humanoid"):remove()
end
end)
end
end
local mouse = game.Players.LocalPlayer:GetMouse()

keysDown = {"w","s","a","d","f"}

mouse.KeyDown:connect(function(key)
keysDown[key] = true
end)

mouse.KeyUp:connect(function(key)
keysDown[key] = false
end)


while wait() do
if keysDown[w] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,0,-1)
end
end
while wait() do
if keysDown[f] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,15,0)
end
end
while wait() do
if keysDown[s] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,0,1)
end
end
while wait() do
if keysDown[a] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(-1,0,0)
end
end
while wait() do
if keysDown[d] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(1,0,0)
end
end




Ok so i have 3 KeyDown loops, at 3 diff times, this script worked, until i added those KeyDown.


Could you please fix the bug thats the KeyDown, script not compatible or what?
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
21 Apr 2014 10:51 AM
Why the heck do you need 10 loops?!
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
21 Apr 2014 10:54 AM
Idk im just horrible :( pls help fix my scripts and or get unhorrible
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
21 Apr 2014 11:06 AM
I will not try to fix that monster of a script, but

mouse.KeyDown:connect(function(key)
keysDown[key] = true
end)

mouse.KeyUp:connect(function(key)
keysDown[key] = nil
end)

You should nil it.
Report Abuse
ajmhm1111 is not online. ajmhm1111
Joined: 22 Jun 2013
Total Posts: 164
21 Apr 2014 11:08 AM
Hello,

Well all that is happening is that it gets down to the loop

while wait() do
if keysDown[w] then
arge.Torso.CFrame = arge.Torso.CFrame*CFrame.new(0,0,-1)
end
end

And that is all it does.

And if you try to remove that loop then it will just constantly do the next very small while wait() do loop.

I cannot be bothered to try and format it correctly because it would cause my mind to explode. Hope this helped, sort of :3

--ajmhm1111
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
21 Apr 2014 11:12 AM
um.. wtf?
Report Abuse
ajmhm1111 is not online. ajmhm1111
Joined: 22 Jun 2013
Total Posts: 164
21 Apr 2014 11:15 AM
You have a while wait() do
--some code
end
(Well many)
When the script is running, it gets to that point and only does some code and none of the other code.
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
21 Apr 2014 11:16 AM
So do i add them in 1 loop?
Report Abuse
ajmhm1111 is not online. ajmhm1111
Joined: 22 Jun 2013
Total Posts: 164
21 Apr 2014 11:22 AM
I cannot think because of the size of the script.

Sure why not :3

--ajmhm1111
Report Abuse
Kingmouli is not online. Kingmouli
Joined: 28 Sep 2012
Total Posts: 1292
21 Apr 2014 11:28 AM
Coroutines?
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
21 Apr 2014 11:28 AM
:3
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