|
| 07 Jan 2017 03:28 AM |
hey all,
im trying to make enemy health dependant on a few factors, mostly to do with the enemys stats, but id also like it to depend on the players level, and difficulty picked.
The problem is to get such stats i would need a localscript which limits where i can put it, if i put it in playerscripts how would i use it to adjust health if the model is in workspace? or would i have to put it somewhere else to be able to call it?
Thanks
|
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 03:42 AM |
Well, say you had it in the StarterPlayerScripts. That can be a way to target players. To get the character, there is one simple line of code to put in any script to get the localplayer's character:
character = game.Players.LocalPlayer.Character
That would select the character.
Say if you opened the workspace in a play mode (With the explorer). You would open the workspace and find models with the players names as the name of the model. Say you open that. That code above would select the model in the workspace with the players name as the model's name. |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 03:42 AM |
Use remote events and remote functions
Love breeds sacrifice... which in turn breeds hatred. Then you can know pain. |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 04:08 AM |
Ok, if i did that then would i be able to use character = game.Players.LocalPlayer.Character in any script even if it was in workspace and i guess it would still have to be a LocalScript?
I will have to use remote functions anyway as i want FE on as afaik i havent seen a game like im planning yet on roblox so want it to be fun and fair. only thing is im new to remote functions so dont really know how to use them fully yet.
|
|
|
| Report Abuse |
|
|
|
| 07 Jan 2017 04:11 AM |
i just re-read your post and completely missed the bottom paragraph.
What i mean is the enemy units model would be in workspace, so i need to adjust their Health and MaxHealth with the current players lvl, so if a lvl 1 player joins the units health would be like 10hp but if a lvl 100 got the same unit it would be like 100,000hp
|
|
|
| Report Abuse |
|
|