|
| 07 Jun 2015 11:28 PM |
I'm a new scripter trying to make scripts. For some reason there is a squiggly line under the first equal sign in this script:
function if PlayerId = ("48169798") then Part.Door.CanColide = false wait(1) then Part.Door.CanColide = true end end
Could you people help out? |
|
|
| Report Abuse |
|
|
|
| 07 Jun 2015 11:32 PM |
| oh squiggly line under the if, if i take out the if there's a squiggly line under the first equal sign where it says PlayerId = ("48169798") |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 07 Jun 2015 11:36 PM |
However, make sure that PlayerId and Part are defined somewhere above this all..
The reason it was squiggly was because you need a double equals sign when comparing.
local magic = function() if PlayerId == 48169798 then Part.Door.CanColide = false wait(1) then Part.Door.CanColide = true end end |
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 07 Jun 2015 11:37 PM |
My bad, I forgot to take out a rogue _then_.
local magic = function() if PlayerId == 48169798 then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 07 Jun 2015 11:39 PM |
And CanCollide is spelled wrong
=volty= |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 07 Jun 2015 11:41 PM |
Problems: 1. the function needs a name
function WhateverYouwant() if PlayerId = ("48169798") then Part.Door.CanColide = false wait(1) then Part.Door.CanColide = true end end
2.When ur checkiong, u need two =='s
function WhateverYouwant() if PlayerId == ("48169798") then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end
3. You forgot to say waht part is, all the computer knows is workspace and the script.Parent, so u need to define part. Lets add the argument of who touched it, we'll need it later.
local Part = game.Workspace.Part function WhateverYouwant(hit) if PlayerId == ("48169798") then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end
4. You never called the function, that just means u write it so it does it. Lets say we call the function when someone touches the door, then we use the touched function, which we connect it to.
local Part = game.Workspace.Part function WhateverYouwant(hit) if PlayerId == ("48169798") then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end
Part.Door.Touched:connect(WhateverYouwant)
5.Lets say who the person is, so we can find their id to check
local Part = game.Workspace.Part function WhateverYouwant(hit) local PLAYER = game.Players:GetPlayerFromCharacter(hit.Parent) if PlayerId == ("48169798") then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end
Part.Door.Touched:connect(WhateverYouwant)
6. What if a person doesent touch it and a brick does? then it'll make an error, so lets add a pcall(restarts if it errors)
local Part = game.Workspace.Part function WhateverYouwant(hit) pcall(function() local PLAYER = game.Players:GetPlayerFromCharacter(hit.Parent) if PlayerId == ("48169798") then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end) end
Part.Door.Touched:connect(WhateverYouwant)
7. Now that we have the player, all we need is the Id to check if he can open the door. So lets do that by adding a defined variable called PlayerId, as you said.
local Part = game.Workspace.Part function WhateverYouwant(hit) pcall(function() local PLAYER = game.Players:GetPlayerFromCharacter(hit.Parent) PlayerId = PLAYER.userID-- this takes the Id! if PlayerId == ("48169798") then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end) end
Part.Door.Touched:connect(WhateverYouwant)
Alright, put this in a normal script in workspace.
local Part = game.Workspace.Part function WhateverYouwant(hit) pcall(function() local PLAYER = game.Players:GetPlayerFromCharacter(hit.Parent) PlayerId = PLAYER.userID-- this takes the Id! if PlayerId == ("48169798") then Part.Door.CanColide = false wait(1) Part.Door.CanColide = true end end) end
Part.Door.Touched:connect(WhateverYouwant)
Make sure there is a Part in the workspace named "Part" and a door inside it. Hope it works! Report any errors if it doesent
|
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 07 Jun 2015 11:43 PM |
sry, looks like can collide is spelled wrong, put this script in
local Part = game.Workspace.Part function WhateverYouwant(hit) pcall(function() local PLAYER = game.Players:GetPlayerFromCharacter(hit.Parent) PlayerId = PLAYER.userID-- this takes the Id! if PlayerId == ("48169798") then Part.Door.CanCollide = false wait(1) Part.Door.CanCollide = true end end) end
Part.Door.Touched:connect(WhateverYouwant) |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 07 Jun 2015 11:43 PM |
CanCollide is still spelled wrong in the script.
=volty= |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
|
| 07 Jun 2015 11:44 PM |
got ninja'd and also it's userid not userID
=volty= |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 07 Jun 2015 11:46 PM |
| really? I got told otherwise. |
|
|
| Report Abuse |
|
|
voItages
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 677 |
|
| |
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 08 Jun 2015 12:02 AM |
local Part = game.Workspace.Part function WhateverYouwant(hit) pcall(function() local PLAYER = game.Players:GetPlayerFromCharacter(hit.Parent) PlayerId = PLAYER.userId-- this takes the Id! if PlayerId == ("48169798") then Part.Door.CanCollide = false wait(1) Part.Door.CanCollide = true end end) end
Part.Door.Touched:connect(WhateverYouwant)
this will work. Try it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Jun 2015 10:26 AM |
Lol he just replys jesus christ
LeBlanc true assassin http://www.roblox.com/Trade/TradeWindow.aspx?TradePartnerID=41451881 |
|
|
| Report Abuse |
|
|