Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 24 Jun 2017 08:50 AM |
i found out that in the main script its named 'PointsService' so i changed the door to this
local PointsService = game:GetService("PointsService") local Door = script.Parent;
game.Players.PlayerAdded:connect(function(player) -- Get total number of points this game has already awarded to the player local PointsService = PointsService:GetGamePointBalance(player.userId) function onTouched(part) if ( PointsService == 10) then function open() Door.Transparency = 0.5; Door.CanCollide = false; wait(2); Door.CanCollide = true; Door.Transparency = 0; end end end
no luck |
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 24 Jun 2017 09:16 AM |
| You're still using Players.PlayerAdded? Why? |
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 24 Jun 2017 09:19 AM |
| because my scripting knowledge is not a lot..what should be there instead? |
|
|
| Report Abuse |
|
|
ReaIG
|
  |
| Joined: 10 Apr 2017 |
| Total Posts: 4021 |
|
| |
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
| |
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 24 Jun 2017 10:59 AM |
| > You need to connect to Touched. Currently you only open the door once, when the player joins the game. |
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 24 Jun 2017 11:26 AM |
@above
i though i did that by doing
function onTouched(part) if ( PointsService == 10) then function open() Door.Transparency = 0.5; Door.CanCollide = false; wait(2); Door.CanCollide = true; Door.Transparency = 0; end |
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 24 Jun 2017 06:41 PM |
Lol. No. wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
Also fix your indentation. |
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 24 Jun 2017 08:17 PM |
so this then?
local PointsService = game:GetService("PointsService") local Door = script.Parent;
workspace.Part.Touched:connect(function(otherPart)
game.Players.PlayerAdded:connect(function(player)) -- Get total number of points this game has already awarded to the player local PointsService = PointsService:GetGamePointBalance(player.userId) function onTouched(part) if ( PointsService == 10) then Door.Transparency = 0.5; Door.CanCollide = false; wait(2); Door.CanCollide = true; Door.Transparency = 0; end end end |
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 25 Jun 2017 09:02 AM |
1) Fix your indentation, seriously. It's important. 2) Make sure your code has no syntax errors. If it can't even be interpreted, surely it won't do what you want it to do. 3) Make sure each line of code is necessary. 4) Running your code is the best and only good way to find out whether your code works or not. |
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 25 Jun 2017 08:52 PM |
local PointsService = game:GetService("PointsService")
local PointsService = PointsService:GetGamePointBalance(player.userId) Door = script.Parent
function onTouched(hit)
if ( PointsService == 10) then
print("Door Hit")
Door.Transparency = .5
Door.CanCollide = false
wait(7)
Door.CanCollide = true
Door.Transparency = 0
end end
connection = Door.Touched:connect(onTouched)
tested and stil not working |
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 26 Jun 2017 04:23 AM |
Yay, much better. A few leading questions: 1) Where do you define 'player'? Which player is that? 2) Does 'PointsService' ever change once it was defined in the first two lines? (Btw you might want to use a separate variable instead of redefining this one, just for clarity.) 3) When a door is touched, how do you check that the object that touched the door is a player? If it is a player, which one? |
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 26 Jun 2017 06:00 AM |
local PointsService = game:GetService('PointsService') Door = script.Parent local player = game.Players:FindFirstChild(Touched.Parent.Name)
script.Parent.Touched:connect(function(Touched) if Touched.Parent:FindFirstChiled('Humanoid') then
if ( PointsService == 10) then
print("Door Hit")
Door.Transparency = .5
Door.CanCollide = false
wait(7)
Door.CanCollide = true
Door.Transparency = 0 end end end)
still does not work |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2017 09:02 AM |
| local Players=game:GetService"Players" local PointsService=game:GetService"PointsService" local Door=workspace.MyDoor Door.Touched:Connect(function(v) v=v and v.Parent v=v and v.className=='Model'and Players:GetPlayerFromCharacter(v) if v and PointsService:GetGamePointBalance(v.UserId)>5 then print("Player "..v.Name.." has more than # ######## -- open door end end) |
|
|
| Report Abuse |
|
|
ReaIG
|
  |
| Joined: 10 Apr 2017 |
| Total Posts: 4021 |
|
| |
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 26 Jun 2017 10:57 AM |
| what does the " # ########" part mean? |
|
|
| Report Abuse |
|
|
VilgO
|
  |
| Joined: 15 Feb 2011 |
| Total Posts: 518 |
|
|
| 27 Jun 2017 12:59 AM |
| It's possible that it doesn't work because there's a typo in "FindFirstChiled" and an extra "end". Also fix your indentation. |
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 27 Jun 2017 10:38 AM |
ok fixed some of it
local PointsService = game:GetService('PointsService') Door = script.Parent local player = game.Players:FindFirstChild(Touched.Parent.Name)
script.Parent.Touched:connect(function(Touched) if Touched.Parent:FindFirstChild('Humanoid') then
if ( PointsService == 10) then
print("Door Hit")
Door.Transparency = .5
Door.CanCollide = false
wait(7)
Door.CanCollide = true
Door.Transparency = 0 end end)
|
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
| |
|
ghulty
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 42 |
|
|
| 27 Jun 2017 10:40 AM |
| I am sorry but all I can see is your inconsistent use of ;s which ruins the point of them and adds baggage to reading the code... sometimes you use them and sometimes you don't, and when you do you don't when the previous character is a ). Please do not do this |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 10:47 AM |
local PointsService = game:GetService('PointsService') Door = script.Parent local player = game.Players:FindFirstChild(Touched.Parent.Name) local a;script.Parent.Touched:connect(function(Touched)if a then return end a=true delay(.5,function()a=false;end) if Touched.Parent:FindFirstChild('Humanoid') then local player=game.Players:GetPlayerFromCharacter(Touched.Parent) if player and ( PointsService:GetGamePointBalance(player.UserId)>9) then
print("Door Hit")
Door.Transparency = .5
Door.CanCollide = false
wait(7)
Door.CanCollide = true
Door.Transparency = 0 end;end end)
|
|
|
| Report Abuse |
|
|
Dreaderr
|
  |
| Joined: 03 Nov 2014 |
| Total Posts: 844 |
|
|
| 27 Jun 2017 11:13 AM |
@above IT WORKED! thank! though i had to chage
one part to this
local Players = game.Players
now it works PERFECTLY! thanks! and also thank you VilgO for helping me as well! |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 11:14 AM |
| who that Tue Jun 27 2017 18:13:07 GMT+0200 (Hora de verano ######## |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 11:15 AM |
| who that Tue Jun 27 2017 18:13:21 GMT+0200 (Hora de verano ######## |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 11:15 AM |
| who that Tue Jun 27 2017 18:13:37 GMT+0200 (Hora de verano ######## |
|
|
| Report Abuse |
|
|