Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How the heck an I supposed to make this local script work?

Asked by 7 years ago
01local player = game.Players.LocalPlayer
02 
03--all of this goes in a local script, which is in a part
04 
05script.Parent.Touched:connect(function(toucher)
06if game.Players:FindFirstChild(toucher.Parent.Name) then   
07    wait(0.5)
08local a = math.random(1,25) --set the 100 to whatever number you want. setting it higher lowers the chance of getting pulled into a wild battle.
09local b = math.random(1,1)--set the 1 on the right in the parenthesis to however many pokemon you would like to be in the grass.
10print(a)
11if a == 1 then
12 
13print("A Wild Pokemon Appeared!")--Not necessary, just shows that the script is working in the output. Remove this line if you want to.
14 
15 
View all 80 lines...

I've been modifying this script non-stop for 4 hours. I just figured out that the hecking thing doesn't work in game. It says things like 'Attempt to index LocalPlayer' or sometimes it doesn't work at all. Help please. ;-;

0
Local scripts only work if they are a descendant of the player's Backpack, Playergui, Character, PlayerScripts or ReplicatedFirst. From what I can see, this is in a part in the workspace. UgOsMiLy 1074 — 7y
0
Local scripts are locally to the client (No contact to server) and to make a local script communicate with the server you will need to use remote events and remote functions and use server scripts, try and look at tutorials of filtering enabled on roblox. xXiNotoriousXx 31 — 7y
0
I realize that mistake now. I was too tired to think at 2 am. Thanks guys! 222ono222 47 — 7y

Answer this question