![]() So now lets write the function that will clone the rocket in the LocalScript inside StarterPlayerScripts. So when the remote event in ReplicatedStorage gets locally fired, the LocalScript will generate the rocket. We are going to be using that LocalScript to clone the rocket, because if i did that in a server script there would be delay in the fire (the rocket would be frozen for a few seconds). Now i will explain why we need that LocalScript in StarterPlayerScripts. fireEvent.OnServerEvent:Connect(function(plr, mouseHit, coolDown) local tool = script.ParentĪfter that we will script this. But that is all we need to do in the LocalScript, we can now script the server script. When we fire the fire event and use, we will use that to make the rocket face the mouse’s hit. So this is how the shoot function should look tool.Equipped:Connect(function(mouse)įireEvent:FireServer(, coolDown) tool.Equipped:Connect(function(mouse)Īfter that we now script the rest of it with the debounce and cool down. Write this after all of the needed variables. ![]() Now we have got all of our needed variables, we can now script the click function. Local fireEvent = tool:WaitForChild("Fire")ĬoolDown = 3 - Can change value if its is a number So we will write this in the LocalScript. One for the tool, one for the fire event in the tools, one for cool down time, and one for debounce. We are going to script the LocalScript first of course, first we need to setup some variables. Now that we got everything set up, we can begin scripting the tool. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |