So I recently created a sword and I had everything working great. But what i didnt know at the time was the place I was creating it in had FE turned off. So when I brought it over to my other place it no longer works because FE is turned on.

The simplest way to tell you what is happening is, everything is only happening for the player wielding the tool. So when the player with the tool kills someone with the tool they are only dead for the guy with the tool they arent dead for everyone else.

Its just a client to server communication problem, and I have no idea how to fix it.

I have a local script, a script, and a bool value inside the sword.

Heres the local script.

local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local CanAttack = true
local SpecialActivated = false

script.Parent.Equipped:connect(function()
	local Equip = script.Parent.Parent.Humanoid:LoadAnimation(script.Equip)
	local Idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
	local SwingAttack = script.Parent.Parent.Humanoid:LoadAnimation(script.SwingAttack)
	local SideAttack = script.Parent.Parent.Humanoid:LoadAnimation(script.SideAttack)
	local SideAttack2 = script.Parent.Parent.Humanoid:LoadAnimation(script.SideAttack2)
	local Choke = script.Parent.Parent.Humanoid:LoadAnimation(script.Choke)	
	
	local Trail = script.Parent.MainTrail.Trail
	Trail.Attachment0 = Trail.Parent.Attachment
	Trail.Attachment1 = Trail.Parent.Parent.Trail.Attachment
	
	Equip:Play()
	wait(1)
	Idle:Play()
	
	local function onKeyPressed(inputObject, gameProcessedEvent) -- Choke move
		if not gameProcessedEvent then
		if inputObject.KeyCode == Enum.KeyCode.Q then
			if SpecialActivated == false then
			local MainPlayer = Player.Character:WaitForChild("HumanoidRootPart")		
			
			for _, TargetPlayer in pairs(game.Players:GetPlayers()) do
				if  TargetPlayer then 
					local TargetCharacter = TargetPlayer.Character
					local Magnitude = (MainPlayer.Position - TargetCharacter:WaitForChild("HumanoidRootPart").Position).magnitude
					if Magnitude < 25 and Magnitude > 0 then
						SpecialActivated = true
						Choke:Play()
						MainPlayer.Parent.Humanoid.WalkSpeed = 0 
						MainPlayer.Parent.Humanoid.JumpPower = 0
						
						for _, Parts in pairs(script.Parent:GetChildren()) do
							if Parts and Parts:IsA("Part") or Parts:IsA("UnionOperation") or Parts:IsA("WedgePart") then
								Parts.Transparency = 1
							end
						end
						
						local Choking = TargetCharacter.Humanoid:LoadAnimation(script.Choking)
						Choking:Play()
						TargetCharacter.Humanoid.WalkSpeed = 0
						TargetCharacter.Humanoid.JumpPower = 0
						Choking.Stopped:connect(function()
							TargetCharacter.Humanoid.WalkSpeed = 16
							TargetCharacter.Humanoid.JumpPower = 50
							TargetCharacter.Humanoid:TakeDamage(100)
						end)
						
						Choke.Stopped:connect(function()
							SpecialActivated = false
							for _, Parts in pairs(script.Parent:GetChildren()) do
								if Parts and Parts:IsA("Part") or Parts:IsA("UnionOperation") or Parts:IsA("WedgePart") then
									Parts.Transparency = 0
									MainPlayer.Parent.Humanoid.WalkSpeed = 16
									MainPlayer.Parent.Humanoid.JumpPower = 50
									if Parts.Name == "Handle" then
										Parts.Transparency = 1
									end
								end
							end
						end)
					end
				end
			end
			end
			
		elseif inputObject.KeyCode == Enum.KeyCode.E then -- Speed boost
			if not gameProcessedEvent then
				if SpecialActivated == false then
					SpecialActivated = true
					local MainPlayer = Player.Character:WaitForChild("HumanoidRootPart")
					local BlurEffect = Instance.new("BlurEffect")
					MainPlayer.Parent:WaitForChild("Humanoid").WalkSpeed = 24
					BlurEffect.Size = 5
					BlurEffect.Enabled = true
					BlurEffect.Parent = game.Workspace.CurrentCamera
					wait(5)
					MainPlayer.Parent:WaitForChild("Humanoid").WalkSpeed = 16
					BlurEffect.Size = 0
					BlurEffect.Enabled = false
					SpecialActivated = false
				end
			end
		elseif inputObject.KeyCode == Enum.KeyCode.R then -- Health boost
			if not gameProcessedEvent then
					local MainPlayer = Player.Character:WaitForChild("HumanoidRootPart")
					MainPlayer.Parent:WaitForChild("Humanoid").MaxHealth = 600
					MainPlayer.Parent:WaitForChild("Humanoid").Health = 600
					wait(10)
					MainPlayer.Parent:WaitForChild("Humanoid").MaxHealth = 450
					MainPlayer.Parent:WaitForChild("Humanoid").Health = 450
				end
			end
		end
	end
	UserInputService.InputBegan:connect(onKeyPressed)
end)

script.Parent.Activated:connect(function()
	local Equip = script.Parent.Parent.Humanoid:LoadAnimation(script.Equip)
	local Idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
	local SwingAttack = script.Parent.Parent.Humanoid:LoadAnimation(script.SwingAttack)
	local SideAttack = script.Parent.Parent.Humanoid:LoadAnimation(script.SideAttack)
	local SideAttack2 = script.Parent.Parent.Humanoid:LoadAnimation(script.SideAttack2)
	
	if CanAttack == true then
	local RandomAttack = math.random(1,3)
		if RandomAttack == 1 then
			SwingAttack:Play()
			Idle:Stop()
			CanAttack = false
			script.Parent.CanDamage.Value = true
			wait(1) -- Animation Length
			SwingAttack:Stop()
			Idle:Play()
			CanAttack = true
		elseif RandomAttack == 2 then
			SideAttack:Play()
			Idle:Stop()
			CanAttack = false
			script.Parent.CanDamage.Value = true
			wait(1) -- Animation Length
			SideAttack:Stop()
			Idle:Play()
			CanAttack = true	
		elseif RandomAttack == 3 then
			SideAttack2:Play()
			Idle:Stop()
			CanAttack = false
			script.Parent.CanDamage.Value = true
			wait(1) -- Animation Length
			SideAttack2:Stop()
			Idle:Play()
			CanAttack = true
		end
	end
end)

Heres the server script

script.Parent.Blade.Touched:connect(function(hit)
	if script.Parent.CanDamage.Value == true then
		script.Parent.CanDamage.Value = false
		local RandomDamage = math.random(1,3)
		if RandomDamage == 1 then
			hit.Parent.Humanoid:TakeDamage(75)
		elseif RandomDamage == 2 then
			hit.Parent.Humanoid:TakeDamage(80)
		elseif RandomDamage == 3 then
			hit.Parent.Humanoid:TakeDamage(85)
		end
	end
end)

But basically its having server to client communication problems so only the client is seeing everything and other people dont.

Anyone have any ideas?

Thank you for your time. :)

2 comments

0

If the LocalScript does anything to affect another Player, it'll only work locally (obviously). You can get all this done with one server script too.

0

Okay ill try that