![]() ![]() If player.Character:FindFirstChild(tool.Name) then Sometimes you may get an extra ( ) inside Connect ( ) like this buy_1.MouseButton1Click:Connect(buyTool1 ( ) ). This is the sections of code from the LocalScript that deal with buying tools. ![]() Start by checking the output to see if you are getting any error messages. Use the output to identify the error and post it in chat ![]() Make sure you add a remote event toReplicatedStorage and rename it to BuyTool. The remote event was not added or named incorrectly Make sure your buy buttons are name buy1, buy2, and bu圓. Make sure your close button is named closeButton. The gui objects inside the frame must match the names used in the script. If you did not name the part the player goes to when the frame closes closePart then change the name in the explorer menu. If you did not name the part that the player steps on openPart then change the name in the explorer menu. Click these messages to open the script at the point of error. In the output window error messages will be highlighted in red. Check the output section by clicking the view tab at the top and then selecting the output button. There is an error somewhere in the script. Local tool = ReplicatedStorage.ShopItemsĬloseButton.MouseButton1Click:Connect(closeMenu)īuy_1.MouseButton1Click:Connect(buyTool1)īuy_2.MouseButton1Click:Connect(buyTool2)īuy_3.MouseButton1Click:Connect(buyTool3) Local player = game.Players:FindFirstChild() Local remoteEvent = ReplicatedStorage:WaitForChild('BuyTool') Local button = ReplicatedStorage = game:GetService('ReplicatedStorage') The third way is to just copy-paste the function. ![]() Anyway, - Script 1īutton.Activated:Connect(require())īutton.Touched:Connect(require()) I will be doing this with a ModuleScript, but you can also do _G.onActivated = onActivated in Script 1 if you want to shoot yourself in the foot. The second way is to expose the function that the button calls, and let other things call it. Makes touching the part named Button do the same as clicking the GUI button Local event = Instance.new("BindableEvent") One is to make a custom BindableEvent and make it also connect to the same function, and then Fire the BindableEvent to simulate a click. You probably have a TextButton with a MouseButton1Click or Activated event that does something, and you want the event to fire as if it had been clicked, without the player clicking it. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |