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.
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!