Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My script is not working after I press the gui, and not outputting errors. Help?

Regular Script

game.ReplicatedStorage.Wall.OnServerEvent:Connect(function(player,button)

    --//Variables\\--

   local replicated = game.ReplicatedStorage

   local wall = replicated.BrickWall:Clone()

   wall.Parent = game.Workspace

    for i = 0,6,0.1 do

	    wall.CFrame = wall.CFrame * CFrame.new(0,i,0)

	    wait()
   
    end

end)

Local Script

wait()

--//Variables\\--

  

local player = game:GetService("Players").LocalPlayer

local RemoteEvent = game.ReplicatedStorage.Wall

local button = game.Workspace.StarterGui.ScreenGui.TextButton

  

button.MouseButton1Click:Connect(function()

RemoteEvent:FireServer()

end)

I'm trying to make a wall/shield type thing that spawns when you click the gui and comes up from the ground.

1 answer

✓ Accepted answer

StarterGui is NOT where you should be applying events.

StarterGui just clones the all objects parented to it into LocalPlayer.PlayerGui, in this case it would be your ScreenGui.

It would rather be:

local button = LocalPlayer.PlayerGui.ScreenGui.TextButton

Everything else seems fine. Good luck with your project!

This discussion is preserved as it was. New answers, comments, and votes are closed.