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: Function firing on wrong key?

Previous Thread :: Next Thread 
Cyerwyn is online. Cyerwyn
Joined: 09 Mar 2013
Total Posts: 3442
26 Nov 2016 09:15 PM
Now this is quite odd. I have a function that works and everything is fine and dandy, but it will randomly fire the second "if" without pressing the r key. Any idea as to why? I switched it from an elseif to just a regular if because the elseif was not working.


===
local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
local lleg = character:WaitForChild("Left Leg")
local larm = character:WaitForChild("Left Arm")
local rarm = character:WaitForChild("Right Arm")
local rleg = character:WaitForChild("Right Leg")
local head = character:WaitForChild("Head")
local human = character:WaitForChild("Humanoid")
local torso = character:WaitForChild("Torso")
local shirt = character:WaitForChild("Shirt")
local pants = character:WaitForChild("Pants")
local hasteleported = false
local isteleporting = false
local UserInputService = game:GetService("UserInputService")
local parts = {lleg, larm, rarm, rleg, head}
local isCyerwyn = "Cyerwyn"





UserInputService.InputBegan:Connect(function(Input,GPE)
if not GPE then
if Input.KeyCode == Enum.KeyCode.R and isteleporting == false and hasteleported == false then
isteleporting = true
local fireflygenerator = game.Lighting.fireflygenerator:Clone()
fireflygenerator.Parent = character
fireflygenerator.Transparency = 1
fireflygenerator.Position = torso.Position - Vector3.new(0, 3.5, 0)
human.WalkSpeed = 0
wait(2)
shirt.Parent = game.Lighting
pants.Parent = game.Lighting
head.face.Parent = game.Lighting
for i, v in pairs(character:GetChildren()) do
if v:IsA("Part") then
v.BrickColor = BrickColor.new("Really black")
elseif v:IsA("Accessory") then
v.Handle.Mesh.TextureId = 0
v.Handle.BrickColor = BrickColor.new("Really black")


end

end

wait(2)
human.WalkSpeed= 15
fireflygenerator.FireFlies.Lifetime = NumberRange.new(0, 0)
wait(3)
fireflygenerator:Destroy()
isteleporting = false
hasteleported = true
end
end
if Input.KeyCode == Enum.KeyCode.R and isteleporting == false and hasteleported == true then
isteleporting = true
local fireflygenerator = game.Lighting.fireflygenerator:Clone()
fireflygenerator.Parent = character
fireflygenerator.Transparency = 1
fireflygenerator.Position = torso.Position - Vector3.new(0, 3.5, 0)
human.WalkSpeed = 0
wait(2)
game.Lighting.face.Parent = head
shirt.Parent = character
pants.Parent = character
for i, v in pairs(character:GetChildren()) do
if v:IsA("Part") then
v.BrickColor = BrickColor.new("Pastel brown")
elseif v:IsA("Accessory") then
v.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=75976712"
v.Handle.BrickColor = BrickColor.new("Medium stone grey")

end

end

wait(2)
human.WalkSpeed= 15
fireflygenerator.FireFlies.Lifetime = NumberRange.new(0, 0)
wait(3)
fireflygenerator:Destroy()
isteleporting = false
hasteleported = false

end

end)


===
Report Abuse
Cyerwyn is online. Cyerwyn
Joined: 09 Mar 2013
Total Posts: 3442
26 Nov 2016 09:36 PM
bump
Report Abuse
EssentialRoll is not online. EssentialRoll
Joined: 02 Sep 2016
Total Posts: 12189
26 Nov 2016 09:55 PM
no one wants to read through all that

Report Abuse
Cyerwyn is online. Cyerwyn
Joined: 09 Mar 2013
Total Posts: 3442
26 Nov 2016 09:55 PM
If it is something obvious, please let me know. Thanks!
Report Abuse
EssentialRoll is not online. EssentialRoll
Joined: 02 Sep 2016
Total Posts: 12189
26 Nov 2016 10:03 PM
How about you let us know so we don't have to read through that?

Report Abuse
Cyerwyn is online. Cyerwyn
Joined: 09 Mar 2013
Total Posts: 3442
26 Nov 2016 10:23 PM
How about you stop being so abrasive and actually be productive? I see you on almost every other forum either insulting the OP or their ideas, while I try to help them even with my limited knowledge. If you don't have something that benefits the person who needs help, please, don't waste your time or theirs by saying it.
Report Abuse
EssentialRoll is not online. EssentialRoll
Joined: 02 Sep 2016
Total Posts: 12189
26 Nov 2016 10:43 PM
It's your script, why don't you be more productive?

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