|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
| |
|
|
| 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 |
|
|
|
| 03 Sep 2016 06:17 PM |
| Kodran is right tho,its an event |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
|
| 03 Sep 2016 07:06 PM |
| post the script here or on pastebin and give us the link |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|