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: When Player Leaves

Previous Thread :: Next Thread 
xxsquidisrarexx is online. xxsquidisrarexx
Joined: 06 Feb 2014
Total Posts: 118
03 Sep 2016 06:02 PM
Okay so basically im new to scripting and all and i made this script
wait(4)
function onTouched(hit)
getPlayerName = hit.Parent.Name
wait(1)
print("This mutants name is "..getPlayerName)
script.Parent.Name="Owned By: "..getPlayerName
end

if game.Players.getPlayerName.
script.Parent.Name="Owned By Noone"
end
script.Parent.Head.Touched:connect(onTouched)

and theese lines

if game.Players.getPlayerName.
script.Parent.Name="Owned By Noone"
end
I had no clue what i was typing i guess i was in the right direction?
but how would i continue this script to make so if the getPlayerName = The player who touched the part leaves the part changes name to Owned by noone! Please help
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
03 Sep 2016 06:09 PM
use PlayerRemoving
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
03 Sep 2016 06:12 PM
game.Players.PlayerRemoving:connect(function(player)
script.Parent.Name="Owned by Nobody"
end

also you can use "Player.Name" instead of "getPlayerName"

but its fine tho you were doin great
Report Abuse
xxsquidisrarexx is online. xxsquidisrarexx
Joined: 06 Feb 2014
Total Posts: 118
03 Sep 2016 06:13 PM
Okay so now im getting this error?'



01:10:29.151 - getPlayerName is not a valid member of Players

And heres the current script

wait(4)
function onTouched(hit)
getPlayerName = hit.Parent.Name
wait(1)
print("This mutants name is "..getPlayerName)
script.Parent.Name="Owned By: "..getPlayerName
end

if game.Players.getPlayerName.PlayerRemoving
then
script.Parent.Name="Owned By Noone"
end
script.Parent.Head.Touched:connect(onTouched)
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
03 Sep 2016 06:16 PM
it's an event


Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
03 Sep 2016 06:16 PM
thats not how it works you just do

game.Players.PlayerRemoving:connect(function(player)
script.Parent.Name="Owned by Nobody"
end

also that error where it says "getPlayerName is not a valid member of Player"

just do

script.Parent.Name="Owned by"..Player.Name

Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
03 Sep 2016 06:17 PM
Kodran is right tho,its an event
Report Abuse
xxsquidisrarexx is online. xxsquidisrarexx
Joined: 06 Feb 2014
Total Posts: 118
03 Sep 2016 06:21 PM
wait(4)
function onTouched(hit)
getPlayerName = hit.Parent.Name
wait(1)
print("This mutants name is "..getPlayerName)
script.Parent.Name="Owned By: "..getPlayerName
end

game.Players.PlayerRemoving:connect(function(player)
script.Parent.Name="Owned by Nobody"
end

script.Parent.Head.Touched:connect(onTouched)
Okay thats the current script i got
and now i get this error
01:19:48.788 - Workspace.Noones Orb.Script:13: ')' expected (to close '(' at line 9) near 'script'

also sorry for being such a noob i started learning lua yesterday!
Report Abuse
xxsquidisrarexx is online. xxsquidisrarexx
Joined: 06 Feb 2014
Total Posts: 118
03 Sep 2016 06:33 PM
BUMP
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
03 Sep 2016 07:06 PM
post the script here or on pastebin and give us the link
Report Abuse
xxsquidisrarexx is online. xxsquidisrarexx
Joined: 06 Feb 2014
Total Posts: 118
03 Sep 2016 07:15 PM
its all working now :) Right now im trying to figure out how to make the orb circle the player after beacoming the owner
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