I want to make a wall appear in front of me by pressing a button but it won’t appear like I want it to
The wall appears, but I would have to quickly click the screen and the button while it’s loading before the character loads. I would also have to keep pressing the button for the wall to fully form.
I’ve tried using WaitForChild() but that does not work
Here is the local script for the UserInputService
UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local enable = false
UserInputService.InputBegan:Connect(function(input, isTyping)
if not isTyping then
if not enable then
enable = true
if input.KeyCode == Enum.KeyCode.M then
game.ReplicatedStorage.MudWall:FireServer()
wait(1)
enable = false
end
end
end
end)
Here go the actual wall
local mudwall = game.ServerStorage:WaitForChild("mudwall")
game.ReplicatedStorage.MudWall.OnServerEvent:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local newMudwall = mudwall:Clone()
newMudwall.Position = Vector3.new(14,0,-68)
local TweenService = game:GetService("TweenService")
local part = game.ServerStorage.mudwall
--local part = script.Parent
local info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local goals = {Size = Vector3.new(16,14,2);
Position = Vector3.new(14,0,-68)}
local tween = TweenService:Create(part,info,goals)
newMudwall.Parent = workspace
wait(1)
tween:Play()
end)
And I already made a Remote Event for the wall
I would be grateful for any help.