cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 27 Mar 2015 10:42 PM |
local Player = script.Parent.Parent.Parent.Parent local pGui = Player:WaitForChild("PlayerGui") local Character = Player.Character or Player.CharacterAdded:wait() local Torso = Character:WaitForChild("Torso") local GamePassService = game:GetService("GamePassService") local passId = 230028426 local vip = Character:FindFirstChild("Head") local vip2 = vip:FindFirstChild("vipstring")
script.Parent.MouseButton1Click:connect(function() if(GamePassService:PlayerHasPass(Player,passId))then Torso.CFrame = CFrame.new(-719.675, -8.7, 368.333) wait(1) elseif vip2.Value == true then print'finally works' wait(1) pGui.NoPass.NoPass.Visible = true wait(5) pGui.NoPass.NoPass.Visible = false game:GetService("MarketplaceService"):PromptPurchase(Player,passId) wait(1) end end)
Output:
03:39:29.112 - Players.Player.PlayerGui.Island.Button.Script:15: attempt to index upvalue 'vip2' (a nil value) 03:39:29.113 - Stack Begin 03:39:29.113 - Script 'Players.Player.PlayerGui.Island.Button.Script', Line 15 03:39:29.114 - Stack End
Facts: The value IS inside the Character's Head. The value IS set to TRUE. The script is a Server Script. The script is inside of a GUI Butoon. |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
| |
|
|
| 27 Mar 2015 10:58 PM |
For the first line, 'game.Players.LocalPlayer' is more efficient.
And, 'MouseButton1Click' doesn't work, 'MouseButton1Down' would I believe. Haven't scripted rbx.lua for awhile but try that. |
|
|
| Report Abuse |
|
|
Lecturous
|
  |
| Joined: 17 Aug 2013 |
| Total Posts: 1096 |
|
|
| 27 Mar 2015 11:16 PM |
@heli he said "This script is a server script" LocalPlayer only in LocalScript |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 27 Mar 2015 11:16 PM |
http://wiki.roblox.com/index.php?title=MouseButton1Click&redirect=no
MouseButton1Click is fine too |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 27 Mar 2015 11:18 PM |
| I have posted the output too, and I am unable to fix what's going on - because everything appears to be correct. |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 27 Mar 2015 11:36 PM |
| You have to define what vip2 is INSIDE the function not, outside. This annoyed me but its just how lua works. |
|
|
| Report Abuse |
|
|
cokePanda
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 1901 |
|
|
| 27 Mar 2015 11:42 PM |
| Whoa, that took me good few hours of trying different things. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 28 Mar 2015 11:28 AM |
| Trust me, things have never frustrated me more than the syntax of Lua. |
|
|
| Report Abuse |
|
|
|
| 28 Mar 2015 11:33 AM |
local Player = script.Parent.Parent.Parent.Parent local pGui = Player:WaitForChild("PlayerGui") local Character = Player.Character or Player.CharacterAdded:wait() local Torso = Character:WaitForChild("Torso") local GamePassService = game:GetService("GamePassService") local passId = 230028426 local vip = Character:FindFirstChild("Head") local vip2 = vip:FindFirstChild("vipstring")
repeat wait() until Player and pGui and Character and Torso and vip and vip2
script.Parent.MouseButton1Click:connect(function() if(GamePassService:PlayerHasPass(Player,passId))then Torso.CFrame = CFrame.new(-719.675, -8.7, 368.333) wait(1) elseif vip2.Value == true then print'finally works' wait(1) pGui.NoPass.NoPass.Visible = true wait(5) pGui.NoPass.NoPass.Visible = false game:GetService("MarketplaceService"):PromptPurchase(Player,passId) wait(1) end end)
they don't all load at the same time. |
|
|
| Report Abuse |
|
|