|
| 08 May 2014 04:27 PM |
script.Parent.ChildAdded("SeatWeld") function onKeyDown( e ) script.Parent.Parent.EngineRunning = true script.Parent.CarStartSound:Play() elseif script.Parent.ChildRemoved("SeatWeld") then return nil end
mouse.onKeyDown:connect(onKeyDown) |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 08 May 2014 04:29 PM |
please, learn how to script. if this is troll u won
im going upstairs to get somehting downstairs |
|
|
| Report Abuse |
|
|
|
| 08 May 2014 04:30 PM |
op, i think you need to revisit the basics.
|
|
|
| Report Abuse |
|
|
| |
|
|
| 08 May 2014 04:47 PM |
| and wat did I do wrong??? am sure I did lots wrong, but wat??? and how to fix??? |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 08 May 2014 04:52 PM |
MY EYES BLEED.
mouse.KeyDown:connect(function(key) repeat wait() until script.Parent.ChildAdded("SeatWeld") --Too lazy to do this in a better way. if key == "e" then if script.Parent.Parent.EngineRunning ~= true then script.Parent.Parent.EngineRunning = true end script.Parent.CarStartSound:Play() if 1+1 ~= 2 then return end --Learn to math. end end) |
|
|
| Report Abuse |
|
|
|
| 08 May 2014 04:59 PM |
| but does it fully do wat I want? cos I want it to be like that if ur sitting in the seat and press E and then EngineStart Value is turned to true from false (cos I see u said 'if Value == true then Value = true end' and the Sound is played, and then I anna add a thing that if u press E again then it shuts ur engine down (puts Value as false) and then plays the shutdown sound (gonna add it)... anyways, at least someone helped :D |
|
|
| Report Abuse |
|
|
|
| 08 May 2014 05:24 PM |
| I try press e and nothing happens, I cant drive, nor is there a sound |
|
|
| Report Abuse |
|
|
|
| 08 May 2014 06:10 PM |
| Kapit, go learn the basics. You barely understand a thing |
|
|
| Report Abuse |
|
|
|
| 08 May 2014 06:12 PM |
| dude... I did... and 1 example in the basics I saw was 'onKeyDown == ( keyhere )' so that was wrong, anything else wrong might as well be the same... and anyways, I gotta make a start! am not ust gonna sit there in a boring thing readin wen i can make my own and learn from my mistakes as I go... |
|
|
| Report Abuse |
|
|
zakarq
|
  |
| Joined: 10 Oct 2010 |
| Total Posts: 883 |
|
|
| 08 May 2014 06:19 PM |
| What you need to revisit is the Roblox Wiki. |
|
|
| Report Abuse |
|
|
|
| 08 May 2014 06:21 PM |
^
yeah, when I started, I didn't start with keydown stuff.
I started with printing, then moved to ifs, functions and so forth. I bet you didn't even learn these things |
|
|
| Report Abuse |
|
|
| |
|
| |
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 09 May 2014 01:52 AM |
KeyDown scripting is tricky and requires a tool or local script to get the mouse.
HOWEVER print("REVISIT SCRIPTING BASICS FIRST"). |
|
|
| Report Abuse |
|
|
|
| 09 May 2014 03:48 AM |
| tehl, I did :P I did functions, print, keydownm leaderboards, and not in the scripting thing, I know wat all yas didnt look at! and thats y there are hardly any good cars on Roblox, only the designs are impressive, but not the persofrmance! so stop saying crap to me if yas havent read everything urselves! |
|
|
| Report Abuse |
|
|
|
| 09 May 2014 04:09 AM |
Guys. You realize this is why everyone hates us? Your telling him comments like "learn to script" "this HAS to be a troll" and "revisit the basics"
We're ScriptingHelpers, and quite frankly, this isn't helping.
Now, on to OP. kapitanovas, I don't think you completely understand elseif. In order to use elseif you need an if. Also keydown works s bit differently... Try this;
script.Parent.ChildAdded("SeatWeld")
mouse.onKeyDown:connect(function(k) --On keydown, check what key was pressed and assign to k if k:lower()=="e" and script.Parent.Parent.EngineRunning == false then --Check to see if e was pressed and the engine is off script.Parent.Parent.EngineRunning = true --Start the engine script.Parent.CarStopSound:Stop() --Stop if it is still going. script.Parent.CarStartSound:Play() --Play elseif k:lower()=="e" and script.Parent.Parent.EngineRunning == true then --Check if e was pressed and engine is on. script.Parent.Parent.EngineRunning = false --Stop the engine script.Parent.CarStartSound:Stop() --Stop if it is still going. script.Parent.CarStopSound:Play() --Play end --if/elseif/else require an end to close them
script.Parent.ChildRemoved("SeatWeld") --Can you please explain what your doing here?
end) --Functions also require an end. And the brack is to close the connection line.
There. I also seperate s two lines from the others asking what you were doing. |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 09 May 2014 04:11 AM |
He learned it all wrong.
He must revisit basics or more probs will come. |
|
|
| Report Abuse |
|
|
|
| 09 May 2014 04:12 AM |
also if your going to use mouse.KeyDown() you have to be using a LocalScript and this gotta be the first line;
mouse = game.Players.LocalPlayer:GetMouse() |
|
|
| Report Abuse |
|
|
|
| 09 May 2014 04:13 AM |
@vlek
I understand that. But maybe he had trouble with it. That doesn't give anybody the right to be mean to him.
Maybe he needs someone to help him learn. Ever think of that? |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 09 May 2014 04:16 AM |
I aint being mean, And i ment your getmouse post.
If he needs help with understanding he has to come here, and if he wants working scripts then he should learn basics with dedication and not only for the stuff you need.
|
|
|
| Report Abuse |
|
|
|
| 09 May 2014 04:25 AM |
| thnx a lot warspyking, thnx for standing up and also for helping out :D also, I wanted the ChildRemoved(SeatWeld) to not let the person to get the car running, so u have to be in the VehicleSeat to get the car running... u get me? |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
|
| 09 May 2014 04:31 AM |
Your welcome. So you want them to be sat when they do it. That is a bit more complicated and I have to go, I can help you later.
Also kap, incase you do wanna revisit the basics, I highly reccomend these guides;
http://www.roblox.com/Forum/ShowPost.aspx?PostID=133254933 |
|
|
| Report Abuse |
|
|