Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Need help on this door script?

Asked by 11 years ago

hey guys i am having trouble with this simple door script

01debounce = false
02 
03function onTouch(obj)
04if debounce then return
05end
06if obj.Parent == nil then return
07end
08if Players:playerFromCharacter(obj.Parent) == nil
09    then return
10end
11debounce=true
12script.Parent.Transparency=0.9
13script.Parent.CanCollide= false
14 
15wait(2)
View all 21 lines...

i am very new to scipting, 1st week, does it matter what name i put the brick as and also i put this script under the brick i want this to do it to if it matters

1 answer

Log in to vote
1
Answered by
Freemium 110
11 years ago

playerFromCharacter isn't a valid method. I believe your looking for GetPlayerFromCharacter. You also forgot to define "player" on line 8.

01debounce = false
02players = game.Players --You forgot to define "players"
03function onTouch(obj)
04if debounce then return
05end
06if obj.Parent == nil then return
07end
08if players:GetPlayerFromCharacter(obj.Parent) == nil --Changed to GetPlayerFromCharacter
09    then return
10end
11debounce=true
12script.Parent.Transparency=0.9
13script.Parent.CanCollide= false
14 
15wait(2)
View all 21 lines...
0
thanks codecakes but what do you mean by define players and what does the last line do the "script.Parent.Touched:connect(onTouch)"...im learning off of roblox wiki but it seems rather vague in explaining thing namelessassasin 30 — 11y
0
playerFromCharacter is a member of the Players service. It does the same thing as GetPlayerFromCharacter. Please modify your answer to include this. User#11893 186 — 11y
Ad

Answer this question