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 » Scripters
Home Search
 

Re: Script worked in Studio, not in game...

Previous Thread :: Next Thread 
cross700 is not online. cross700
Joined: 20 Oct 2012
Total Posts: 258
01 Jun 2015 03:13 PM
This script worked in Studio mode, but when I get on the game, it doesn't work... Help?

function onChatted(msg, recipient, speaker)

local source = string.lower(speaker.Name)
msg = string.lower(msg)
local pos1 = script.Parent.Position
local pos2 = speaker.Character.Head.Position
local dist=(pos1-pos2).magnitude
dist=dist-math.max(math.max(speaker.Character.Head.Size.x, speaker.Character.Head.Size.z), speaker.Character.Head.Size.y)
if (dist <= 3 and script.Parent.On.Value == true) then
local h = game.Players.Player.PlayerGui.ScreenGui.TextLabel
h.Visible = true
h.Text = msg
wait(3)
h.Visible = false
end

end

function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)
Report Abuse
Klink45 is not online. Klink45
Joined: 06 Jun 2011
Total Posts: 26054
01 Jun 2015 03:16 PM
"function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end

game.Players.ChildAdded:connect(onPlayerEntered)"
I'm gonna say that's where you went wrong.
Report Abuse
cross700 is not online. cross700
Joined: 20 Oct 2012
Total Posts: 258
01 Jun 2015 03:19 PM
?
Report Abuse
lateregistration is not online. lateregistration
Joined: 02 Apr 2013
Total Posts: 2630
01 Jun 2015 03:20 PM
maybe change ChildAdded to PlayerAdded
Report Abuse
cross700 is not online. cross700
Joined: 20 Oct 2012
Total Posts: 258
02 Jun 2015 04:28 PM
I tried that already, nothing happened
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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