The stupidest script ever to be made.
#1
Okay. So here is my script, obviously it doesn't work, because of my lack of scripting knowledge, and I was wondering what is missing.
The script is a script to change the player's layer by pressing q and e.

print("Yo, yo, yo. Whazzup mah homiiieeeess!!")

P = Player.Layer

Function Keydown (q)
P = P +1

Function Keydown (e)
P = P -1


Shiggity Shiggity Shwa
[Image: Animated.gif?t=1314294800]
Reply
#2
Well, you need to define Player.

And you need ends on functions.

And you need link(event, function).

And of course you can't have a layer of -1 or of 3.

Here's how I would code this script, inside a tool.

Oh yeah and [ lua ] tags FTW!

[lua]
local tool = script.Parent -- creating a variable
local player = tool.Parent.Parent -- creating a variable from a variable
local character = player.Character
local layer = character:getChild("Body").Layer
local minimum = 0 --you can't have a layer of -1
local maximum = 2 --you can't have a layer of 3

--That's all the variables.
print("Variables loaded!")

function RaiseLayer()
if layer < maximum then
--if the character's layer is below 2 then
layer = layer + 1
else
--if the layer is 2 then
print("You are on the highest layer already.")
end end --Always remember the ends for "do"s, "if"s, and "function"s.

function LowerLayer()
if layer > minimum then
--if the layer is above 0 then
layer = layer - 1
else
--if the layer is 0 then
print("You are on the lowest layer already.")
end end

function KeyPressed(key) --This function contains a variable in itself.
if string.lower(key) == "q" then --Works with caps on
RaiseLayer() --Calls this function
elseif string.lower(key) == "e" then
LowerLayer() --Calls that function
end end

print("Functions loaded!")

link(tool.KeyDown, KeyPressed) --Links the tool being keypressed with the function
[/lua]
Reply
#3
[lua]
game.World:remove();
[/lua]

Put that in your game than play it.
[Image: AmZJnA9.png]
Reply
#4
whats the script?

Reply
#5
Lol better than mine a lot of times.
[Image: bhep1v.jpg]
Reply
#6
I already made a script to do this :3

But anyway

You need to put some function ends

You need to call the functions

And you need to actually check the keydown to see what key was pressed

And you need to define player
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)