Hello, I am trying to make an rc car game. So I have a tool that opens up a gui for the car. It works in StarterGUI, but for some weird reason the gui doesn't work when I use my tool. Can somebody help? Tool open gui script (local):
local menuClone script.Parent.Equipped:Connect(function() if not game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("OreoMenu") then menuClone = script.Parent.OreoMenu:Clone() menuClone.Parent = game:GetService("Players").LocalPlayer.PlayerGui end end) script.Parent.Unequipped:Connect(function() pcall(function() menuClone:Destroy() end) end)
GUI button script (server):
script.Parent.MouseButton1Click:Connect(function() workspace.OreoCar.Shell.Velocity = workspace.OreoCar.Shell.CFrame.LookVector * -100 end)
I placed my gui in the tool
I see several issues with your code. I'll try to solve these, but the main issue is that you're not using remote events. Remote events allow the client and server to communicate with each other. This is especially true with GUIs. Here's my answer.
Local Script
script.Parent.Equipped:Connect(function() local plrGui = game.Players.LocalPlayer.PlayerGui if not plrGui:FindFirstChild("OreoGui") then local oreoClone = script.Parent.OreoMenu:Clone() oreoClone.Parent = plrGui oreoClone.MouseButton1Up:Connect(function() game.ReplicatedStorage.RemoteEvent:FireServer() end) end end) script.Parent.Unequipped:Connect(function() local plrGui = game.Players.LocalPlayer.PlayerGui if plrGui:FindFirstChild("OreoGui") then plrGui.OreoGui:Destroy() end end)
Server Script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function() workspace.OreoCar.Shell.Velocity = workspace.OreoCar.Shell.CFrame * -100 end)
Maybe either the GUI has 'Enabled' set to false, or your frame has 'Visible' set to false. Play the game via studio, open the players tab, open your name, then PlayerGui. Click on the car and see if the GUI goes there. If it doesn't, your problem is on something you scripted. If it does, but doesn't show up in your screen, it's maybe because of one of the reasons I said above.