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

A problem with filtering enabled tool, why is this not working?

I got a problem with FE, the local script and script won't perform, I think that the issue might be the activated event because when I removed it to test, everything performed just fine Local Script:

Player = game.Players.LocalPlayer
Character = Player.Character
Mouse = Player:GetMouse()
Tool = script.Parent
Tool.Activated:connect(function()
local en = true
if en == true then
en = false
Tool.RemoteEvent:FireServer(Mouse.Hit)
wait(5)
en = true
end
end)

Script:

Player = script.Parent.Parent.Parent
Character = Player.Character
Mouse = Player:GetMouse()
Tool = script.Parent
Tool.RemoteEvent.OnServerEvent:connect(function()
	print("Activated")
local Torso = Character.Torso
local Breath = Instance.new("Part")
Breath.Shape = "Ball"
Breath.Size = Vector3.new(6.05, 6.05, 6.05)
Breath.CanCollide = false
Breath.Transparency = 1
local Particle = script.Particle:Clone()
Particle.Parent = Breath
Breath.Parent = Torso
Breath.CFrame = Torso.CFrame
W = Instance.new("Weld")
W.Part0 = Breath
W.C0 = Breath.CFrame:inverse()
W.Part1 = Torso
W.C1 = Torso.CFrame:inverse()
W.Parent = Torso
	local MouseHitP = Mouse.Hit.p
	local Torso = Character.Torso
	    local direction = (MouseHitP - Torso.Position) * Vector3.new(1, 0, 1)
    Torso.CFrame = CFrame.new(Torso.Position, Torso.Position + direction)
end)

1 answer

✓ Accepted answer

Local script:

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Mouse = Player:GetMouse()
local Tool = script.Parent

local Equipped = false 

Mouse.Button1Down:connect(function()
	if Equipped then 
		local en = true
		if en == true then
		en = false
		Tool.RemoteEvent:FireServer(Mouse.Hit)
		wait(5)
		en = true
		end
	end
end)

Tool.Equipped:connect(function()
	Equipped = true 
end)

Tool.Unequipped:connect(function()
	Equipped = false 
end)

Server script:

Player = script.Parent.Parent.Parent
Character = Player.Character
Mouse = Player:GetMouse()
Tool = script.Parent
Tool.RemoteEvent.OnServerEvent:connect(function(player, mousehit) -- you forgot to add the parameters(remember the first parameter is always the player who fired the event)
    print("Activated")
local Character = player.Character -- get the player's character

local Torso = Character.Torso
local Breath = Instance.new("Part")
Breath.Shape = "Ball"
Breath.Size = Vector3.new(6.05, 6.05, 6.05)
Breath.CanCollide = false
Breath.Transparency = 1
local Particle = script.Particle:Clone()
Particle.Parent = Breath
Breath.Parent = Torso
Breath.CFrame = Torso.CFrame
W = Instance.new("Weld")
W.Part0 = Breath
W.C0 = Breath.CFrame:inverse()
W.Part1 = Torso
W.C1 = Torso.CFrame:inverse()
W.Parent = Torso
    local MouseHitP = mousehit.p
    local Torso = Character.Torso
        local direction = (MouseHitP - Torso.Position) * Vector3.new(1, 0, 1)
    Torso.CFrame = CFrame.new(Torso.Position, Torso.Position + direction)
end)

10 comments

0

Didn't work for me, can you maybe test it on your studio so you can know for sure if it is working?

0

It will work if I replace the activated event with like humanoid's jumping event.

0

Not at home right now, can't test it on studio

0

any errors in the output?

0

instead of Tool.Activated, do Mouse.Button1Down:connect(function() end)

0

No errors on the output, I'll try the button1down.

0

Works but I do need the tool to be equipped for it to work, I don't want to just press.

0

Edited my answer. Replace your local script's code with mine.

0

Doesn't work, probably because of the Equipped function? I don't think any of the tool's events work in FE?

0

All I had to do is to to make the bool of Required Handle to false. [SOLVED]

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