Client Problems

So, I made this catch system were your arms follow the ball around but theres a problem. Only your client can see them. What I’m trying to achieve is for all the clients in game are able to see the players arms move at the same time but I don’t know how to work with remotes a-lot. Please help.

Code:

local Player = game:GetService( 'Players' ).LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Torso = Character:WaitForChild( 'UpperTorso' )
local RightArm = Character:WaitForChild('RightUpperArm')
local LeftArm = Character:WaitForChild('LeftUpperArm')
local Instances = Character:WaitForChild( 'Instances' )
local Mouse = Player:GetMouse()
local Remote = game.ReplicatedStorage.Remotes:WaitForChild( 'CRemote' )
local CDebounce = false

local function Catch()
	if not Character:FindFirstChild('Football') then
	
	local RAWeld = Instance.new( 'Weld' )
	local LAWeld = Instance.new( 'Weld' )
	
	RAWeld.Name = 'RAW'
	RAWeld.Part0 = Torso
	RAWeld.Part1 = RightArm
	RAWeld.Parent = Instances
	LAWeld.Name = 'LAW'
	LAWeld.Part0 = Torso
	LAWeld.Part1 = LeftArm
	LAWeld.Parent = Instances
	
	if not CDebounce then
		CDebounce = true end
			local RService = game:GetService( 'RunService' )
			local STime = os.time()
			local Track
			Track = RService.RenderStepped:Connect(function()
			local RCFrame = CFrame.new(Torso.CFrame * Vector3.new(1.2, 1.1, 0), workspace.Football.Position) * CFrame.Angles(math.pi / 2, 0, 0)
			local LCFrame = CFrame.new(Torso.CFrame * Vector3.new(-1.2, 1.1, 0), workspace.Football.Position) * CFrame.Angles(math.pi / 2, 0, 0)
			RAWeld.C0 = Torso.CFrame:toObjectSpace(RCFrame) * CFrame.new(0, -.7, .6)
			LAWeld.C0 = Torso.CFrame:toObjectSpace(LCFrame) * CFrame.new(0, -.7, .6)
			if os.time() - STime >= 3 then
			Track:Disconnect()
			RAWeld:Destroy()
			LAWeld:Destroy()
			if os.time() -  STime >= 0.5 then
				CDebounce = false
				end
			end
		end)
	end
end

local function DWelds(Child)
	if Child.Name == 'Football' then
		task.wait(1)
		local RAWeld = Instances:FindFirstChild( 'RAW' )
		local LAWeld = Instances:FindFirstChild( 'LAW' )
		if RAWeld and LAWeld then
			RAWeld:Destroy()
			LAWeld:Destroy()
		end
	end
end

Mouse.Button1Down:Connect(Catch)
Mouse.KeyDown:Connect(function(Key)
	if string.lower(Key) == 'c' then
		Catch()
	end
end)
Character.ChildAdded:Connect(DWelds)

If you want all the players to see something you have to use a server script not a local. If you’re still wanting it to be client based you can use a remote event and fireallclients

1 Like

If I were to change it into a server script how would that look like?

I don’t know how your game is set up so just tell me if something isn’t working, Put all of these scripts into StarterCharacterScripts by the way. Also, make 2 remote events and put them in the StarterCharacterScripts and name one “button1down” and name the other “keyEvent” for this to work.

-- Server Script

function Catch(Player)
	local Character = Player.Character
	local Torso = Character:WaitForChild( 'UpperTorso' )
	local RightArm = Character:WaitForChild('RightUpperArm')
	local LeftArm = Character:WaitForChild('LeftUpperArm')
	local Instances = Character:WaitForChild('Instances')
	local Mouse = Player:GetMouse()
	local CDebounce = false
	
	if not Character:FindFirstChild('Football') then

		local RAWeld = Instance.new( 'Weld' )
		local LAWeld = Instance.new( 'Weld' )

		RAWeld.Name = 'RAW'
		RAWeld.Part0 = Torso
		RAWeld.Part1 = RightArm
		RAWeld.Parent = Instances
		LAWeld.Name = 'LAW'
		LAWeld.Part0 = Torso
		LAWeld.Part1 = LeftArm
		LAWeld.Parent = Instances

		if not CDebounce then
			CDebounce = true end
		local RService = game:GetService( 'RunService' )
		local STime = os.time()
		local Track
		Track = RService.RenderStepped:Connect(function()
			local RCFrame = CFrame.new(Torso.CFrame * Vector3.new(1.2, 1.1, 0), workspace.Football.Position) * CFrame.Angles(math.pi / 2, 0, 0)
			local LCFrame = CFrame.new(Torso.CFrame * Vector3.new(-1.2, 1.1, 0), workspace.Football.Position) * CFrame.Angles(math.pi / 2, 0, 0)
			RAWeld.C0 = Torso.CFrame:toObjectSpace(RCFrame) * CFrame.new(0, -.7, .6)
			LAWeld.C0 = Torso.CFrame:toObjectSpace(LCFrame) * CFrame.new(0, -.7, .6)
			if os.time() - STime >= 3 then
				Track:Disconnect()
				RAWeld:Destroy()
				LAWeld:Destroy()
				if os.time() -  STime >= 0.5 then
					CDebounce = false
				end
			end
		end)
	end
end

local function DWelds(Child)
	if Child.Name == 'Football' then
		task.wait(1)
		local Instances = script.Parent:WaitForChild('Instances')
		local RAWeld = Instances:FindFirstChild( 'RAW' )
		local LAWeld = Instances:FindFirstChild( 'LAW' )
		if RAWeld and LAWeld then
			RAWeld:Destroy()
			LAWeld:Destroy()
		end
	end
end

script.Parent.button1down.OnServerEvent:Connect(function(player)
	Catch(player)
end)

script.Parent.keyEvent.OnServerEvent:Connect(function(player,key)
	
	key = key:lower()
	if key == "c" then
	Catch(player)	
	end
	
end)
-- local script

mouse = game.Players.LocalPlayer:GetMouse()

mouse.Button1Down:Connect(function()
	script.Parent:WaitForChild("button1down"):FireServer()
end)

mouse.KeyDown:Connect(function(key)
	script.Parent:WaitForChild("keyEvent"):FireServer(key)
end)

It gave me this error.

Once again, make 3 RemoteEvents (not Bindable Events) and name one “keyEvent” name another “button1down” and name the last one “RenderStep” and put everything in the StarterCharacterScripts, once again reply to me if there are errors.

-- Server Script

CDebounce = false

render = false

function Catch(Player)
	
	local Character = Player.Character
	local Torso = Character:WaitForChild( 'UpperTorso' )
	local RightArm = Character:WaitForChild('RightUpperArm')
	local LeftArm = Character:WaitForChild('LeftUpperArm')
	local Instances = Character:WaitForChild('Instances')
	local Mouse = Player:GetMouse()

	if not Character:FindFirstChild('Football') then

		local RAWeld = Instance.new( 'Weld' )
		local LAWeld = Instance.new( 'Weld' )
		
		render = true
		
		RAWeld.Name = 'RAW'
		RAWeld.Part0 = Torso
		RAWeld.Part1 = RightArm
		RAWeld.Parent = Instances
		LAWeld.Name = 'LAW'
		LAWeld.Part0 = Torso
		LAWeld.Part1 = LeftArm
		LAWeld.Parent = Instances



		if not CDebounce then
			CDebounce = true end
	end
end

RService = game:GetService( 'RunService' )
STime = os.time()

Track = script.Parent:FindFirstChild("RenderStep").OnServerEvent:Connect(function(player)
	if render == false then return end
	local Character = player.Character
	local Torso = Character:WaitForChild( 'UpperTorso' )
	local RightArm = Character:WaitForChild('RightUpperArm')
	local LeftArm = Character:WaitForChild('LeftUpperArm')
	local Instances = Character:WaitForChild('Instances')
	
	local RAWeld = Instances:FindFirstChild("Raw")
	local LAWeld = Instances:FindFirstChild("Law")

	local RCFrame = CFrame.new(Torso.CFrame * Vector3.new(1.2, 1.1, 0), workspace.Football.Position) * CFrame.Angles(math.pi / 2, 0, 0)
	local LCFrame = CFrame.new(Torso.CFrame * Vector3.new(-1.2, 1.1, 0), workspace.Football.Position) * CFrame.Angles(math.pi / 2, 0, 0)
	RAWeld.C0 = Torso.CFrame:toObjectSpace(RCFrame) * CFrame.new(0, -.7, .6)
	LAWeld.C0 = Torso.CFrame:toObjectSpace(LCFrame) * CFrame.new(0, -.7, .6)
	if os.time() - STime >= 3 then
		RAWeld:Destroy()
		LAWeld:Destroy()
		if os.time() -  STime >= 0.5 then
			CDebounce = false
			render = false
			return
		end
		return
	end
end)

local function DWelds(Child)
	if Child.Name == 'Football' then
		task.wait(1)
		local Instances = script.Parent:WaitForChild('Instances')
		local RAWeld = Instances:FindFirstChild( 'RAW' )
		local LAWeld = Instances:FindFirstChild( 'LAW' )
		if RAWeld and LAWeld then
			RAWeld:Destroy()
			LAWeld:Destroy()
		end
	end
end

script.Parent.button1down.OnServerEvent:Connect(function(player)
	Catch(player)
end)

script.Parent.keyEvent.OnServerEvent:Connect(function(player,key)

	key = key:lower()
	if key == "c" then
		Catch(player)	
	end
end)


-- local script

mouse = game.Players.LocalPlayer:GetMouse()

mouse.Button1Down:Connect(function()
	
	script.Parent:WaitForChild("button1down"):FireServer()
	
end)

mouse.KeyDown:Connect(function(key)
	
	script.Parent:WaitForChild("keyEvent"):FireServer(key)
	
end)

local RService = game:GetService("RunService")

RService.RenderStepped:Connect(function()
	script.Parent:FindFirstChild("RenderStep"):FireServer()
end)

Now it gave me this error

And also the Track:Disconnect has a orange line under it

The reason for two of the errors not firing to server is because you used a BindableEvent, you have to use a RemoteEvent. The first error about the RenderStep event is due to it not existing. I’ve updated the code you just replied to so use the updated code as well.

Thats the updated code that sent those errors in the output

I know, I updated it today after you sent the picture of the errors.

Edit - better explanation of what I’m trying to say: I updated the code again after you send me to picture of the errors. So what I was trying to say was I updated the code you replied to with the picture of the errors.

Oh. Then what are bindablevents used for?

When a script fires a BindableEvent it does not yield for a return and when it is invoked it yields until the event is handled by the script that requested it to be invoked.

Its funny cause I saw the word “Bind” So I thought it was a way of handling Keybinds as an event

That’s an understandable mistake, you learn something every day.

@temporaryacount101

Now its just spamming errors at me on line 45

Okay I’ve noticed the problem, I will update the code once again.

Let me know when you’ve updated it ima go offline now

I just updated the code, try it now.

Gave me the same error as last time