generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Some help.

Previous Thread :: Next Thread 
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
13 Dec 2013 01:26 PM
while true do
wait(.1)
for _, player in pairs(game.Players:GetPlayers()) do
game.Players[player].PlayerGui.ScreenGui.Shop.GetD.Text = player:DistanceFromCharacter(script.Parent.Position)
end
end

I get this error...

14:26:49.745 - Workspace.Clothing.Fig1.Part.Script:4: bad argument #2 to '?' (string expected, got userdata)
14:26:49.754 - Script 'Workspace.Clothing.Fig1.Part.Script', Line 4
14:26:49.755 - stack end

I have never used "DistanceFromCharacter" or pairs before I am use to using for loops so idk what I am doing.
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
13 Dec 2013 01:29 PM
Also can someone tell me why these keep stacking on top of each other instead of spawning next to each other?

for i = 1,5 do
wait(.5)
ranHouse = {"house1", "house2", "house3", "house4", "house5"}
house = math.random(1, #ranHouse)
local getHouse = game.Lighting[ranHouse[house]]:Clone()
getHouse.Parent = game.Workspace
getHouse.Position = getHouse.Position + Vector3.new(50, 0, 0)
print('Finsihed House '..i)
end
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
13 Dec 2013 01:55 PM
Bump
Report Abuse
TheBlackCloth is not online. TheBlackCloth
Joined: 01 Jul 2013
Total Posts: 219
13 Dec 2013 02:15 PM
Changed it to this and still get an error.


while true do
wait(.1)
local players = game.Players:GetChildren()
for i = 1, #players do
game.Players.players[i].PlayerGui.ScreenGui.Shop.GetD.Text = players[i]:DistanceFromCharacter(script.Parent.Position)
end
end


15:14:06.841 - Workspace.Clothing.Fig1.Part.Script:5: attempt to index field 'players' (a function value)
15:14:06.850 - Script 'Workspace.Clothing.Fig1.Part.Script', Line 5
15:14:06.850 - stack end
Report Abuse
Geodesic is not online. Geodesic
Joined: 02 Jun 2013
Total Posts: 998
13 Dec 2013 02:18 PM
while true do
wait(.1)
for _, player in pairs(game.Players:GetPlayers()) do
local tx = tostring(player:DistanceFromCharacter(script.Parent.Position))
player.PlayerGui.ScreenGui.Shop.GetD.Text = tx
end
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image