|
| 07 Aug 2015 03:48 PM |
player = game.Players.LocalPlayer repeat wait() until player.Character char = player.Character Torso = char:WaitForChild("Torso") statnumbers = player:WaitForChild("statnumbers") Level = statnumbers:WaitForChild("Level") script.Parent.MouseButton1Click:connect(function() if Level.Value >= 10 then Torso.CFrame = CFrame.new(427.8, 108.9, -355.6) end end)
added the waitforchild torso as an attempted fix because it still wouldn't work before. a series of about 12 buttons on a GUI have scripts similar to this and when i join a server to test them, random buttons work if any of them to at all. am i doing something wrong? |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 07 Aug 2015 03:49 PM |
| This isn't in a localscript as I see, because there are no locals. Because of this, you cannot do game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 03:51 PM |
| it is in a localscript..but that means i have to include a "local"? |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 07 Aug 2015 03:53 PM |
Every time you define something in a localscript, you have to do local.
e.g: local player = game.Players.LocalPlayer
as opposed to
player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 03:54 PM |
| ok..i was never aware of that. but sure enough, that worked e.e thanks dude |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
| |
|
|
| 07 Aug 2015 04:32 PM |
| ..now they're all broken again and I don't understand why. I didn't alter it at all since they worked |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 05:06 PM |
| I printed at every other line in the script and it all printed correctly.. |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
| |
|
| |
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
| |
|
|
| 07 Aug 2015 05:32 PM |
| i think hes trying to say you're wrong. i only went with what you said because i have nothing else to go on |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 07 Aug 2015 05:34 PM |
no clue
locals is the only thing I see thats incorreect |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 05:35 PM |
| well this works in another place of mine but not the main game place. and i have no idea what could be breaking it |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 07 Aug 2015 05:37 PM |
any errors?
made sure the positions are all in the same as the place and game place |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 05:39 PM |
uh, yeah it's teleporting me in my place "emptyslot" but not my place "hands of death testing server". in emptyslot im trying to fix the script that checks if a player owns the pass or not.
if not game:GetService("MarketplaceService"):PlayerOwnsAsset(game.Players.LocalPlayer,279771338) then script.Parent.Visible = false end
it works in another script for another GUI of mine at HoD testing place but not at either place on the GUI im working with now.. |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 07 Aug 2015 05:42 PM |
| make sure the id's are correct |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 05:42 PM |
| simple logic is breaking everywhere and i dont understand it T-T |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 07 Aug 2015 05:42 PM |
"Every time you define something in a localscript, you have to do local.
e.g: local player = game.Players.LocalPlayer
as opposed to
player = game.Players.LocalPlayer"
pls no |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 05:43 PM |
| the ID is correct everywhere |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
| |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 07 Aug 2015 06:15 PM |
local player = game.Players.LocalPlayer repeat wait() until player.Character local char = player.Character local torso = char.Torso local stats = player:WaitForChild("stats") local level = stats:WaitForChild("Level")
script.Parent.MouseButton1Click:connect(function() if level.Value >= 10 then torso.CFrame = torso.CFrame * CFrame.new(427.8, 108.9, -355.6) end end)
"Talk is cheap. Show me the code." - Linus Torvalds |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 07 Aug 2015 06:16 PM |
see timeticks put the locals
my brother |
|
|
| Report Abuse |
|
|
|
| 07 Aug 2015 06:16 PM |
| nevermind..thanks, everyone, my scripts decided they like me again and it started working.. |
|
|
| Report Abuse |
|
|