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: GetPlayerFromCharacter Question

Previous Thread :: Next Thread 
Eddy3D is not online. Eddy3D
Joined: 21 Nov 2010
Total Posts: 3017
18 Nov 2012 06:44 PM
funciton onTouched(h)
local g = game.Workspace.GetPlayerFromCharacter
local m = Instance.new("Message")
m.Parent = g.PlayerGui
m.Text = "Greetings"
wait(3)
m:Destroy
end

script.Parent.Touched:connect(h)

I know that is a message when a Player touched the objec.
But do anyone know what is the script for a message when I player has entered the game?



(~'3D'~)
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
18 Nov 2012 07:14 PM
Either use child added on Player or use a player joined function, also the script you posted doesn't work you are miss using GetPlayerFromCharacter and your connection is wrong, and you miss spelled function, and it will break if you don't add a check for g.
Report Abuse
LUVMARIOLUIGI10000 is not online. LUVMARIOLUIGI10000
Joined: 16 May 2009
Total Posts: 1244
18 Nov 2012 08:03 PM
--You don't need GetPlayerFromCharacter(), here is a fixed code:

funciton onTouched(h)
local m = Instance.new("Message")
m.Parent = h.Parent
m.Text = "Greetings"
wait(3)
m:Destroy
end

script.Parent.Touched:connect(onTouched)
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
18 Nov 2012 08:44 PM
@LUV, that puts a Message in the Part, whih would be visible to Everyone.
Report Abuse
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
18 Nov 2012 08:47 PM
unciton onTouched(h)
local g = h:GetPlayerFromCharacter()
local m = Instance.new("Message")
m.Parent = g.PlayerGui
m.Text = "Greetings"
wait(3)
m:Destroy
end

script.Parent.Touched:connect(h)



|Paradoxical|

I shun thy heathen, dost thou not know that flames will devour thy mind?
Report Abuse
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
18 Nov 2012 08:48 PM
oops, sorry

function onTouched(h)
local g = h:GetPlayerFromCharacter()
local m = Instance.new("Message")
m.Parent = g.PlayerGui
m.Text = "Greetings"
wait(3)
m:Destroy
end

script.Parent.Touched:connect(onTouched)



|Paradoxical|

I shun thy heathen, dost thou not know that flames will devour thy mind?
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
18 Nov 2012 08:49 PM
@Mass... no..

function onTouched(h)
local g = game.Players:GetPlayerFromCharacter(h.Parent) -- This is how it's done...
if(g)then
local m = Instance.new("Message")
m.Parent = g.PlayerGui
m.Text = "Greetings"
game.Debris:AddItem(m,3)
end
end
script.Parent.Touched:connect(onTouched)
Report Abuse
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
18 Nov 2012 08:49 PM
oh
derp
sorry, It's late and I'm tired.
thanks for fixing my fail though.
xD




|Paradoxical|

I shun thy heathen, dost thou not know that flames will devour thy mind?
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
18 Nov 2012 08:51 PM
Just so you know, you forgot your parentheses after each Destroy method you used.

:Destroy()
not :Destroy
Report Abuse
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
18 Nov 2012 08:52 PM
I feel so stupid now
..Lol..




|Paradoxical|

I shun thy heathen, dost thou not know that flames will devour thy mind?
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
18 Nov 2012 08:52 PM
I've messed up like that before... xD
Not quite that tired yet, so I figured I'd try and help :3
Report Abuse
izzatnasruna is not online. izzatnasruna
Joined: 09 Jun 2009
Total Posts: 1927
18 Nov 2012 11:29 PM
I see that he wants the message to pop-up right after a player has joined the game right? Or maybe it was me who see it.

For by touching the brick:

Brick.Touched:connect(function(Toucher)
local Message = Instance.new("Message",workspace)
Message.Text = "Greetings O' Mighty"
wait(2.5)
Message:Destroy()
end)


For after a player joined:

game:GetService("Players").PlayerAdded:connect(function(Player)
local Message = Instance.new("Message",workspace)
Message.Text = "Greetings O' Mighty "..Player.Name
wait(2.5)
Message:Destroy()
end)

Do :Destroy() and :remove() method does the same thing or does something different? I'm not an up-to-date robloxian.
Report Abuse
michaelaqz4 is not online. michaelaqz4
Joined: 23 Sep 2009
Total Posts: 1940
18 Nov 2012 11:40 PM
function onTouched(h)
game.Players[h.Parent.Name]
end
script.Parent.Touched:connect(onTouched)
Report Abuse
owenrules12 is not online. owenrules12
Joined: 26 Mar 2009
Total Posts: 402
19 Nov 2012 01:54 AM
debounce = false

script.Parent.Touched:connect(function(h)
if debounce == false then
debounce = true
local h = game.Players:GetPlayerFromCharacter(h.Parent)
m = Instance.new("Message")
m.Parent = p.PlayerGui
m.Text = "Greetings"
wait(3)
m:Destroy()
debounce = false
end
end)

Something like that should do, I added debounce so it doesn't spam.
Report Abuse
Eddy3D is not online. Eddy3D
Joined: 21 Nov 2010
Total Posts: 3017
19 Nov 2012 05:36 PM
Wow interesting and woops I forgot the () after Destroy and mispelled function...



(~'3D'~)
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