Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
royee354 129
6 years ago

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

Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago
Edited 6 years ago

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)

0
Didn't work for me, can you maybe test it on your studio so you can know for sure if it is working? royee354 129 — 6y
0
It will work if I replace the activated event with like humanoid's jumping event. royee354 129 — 6y
0
Not at home right now, can't test it on studio hellmatic 1523 — 6y
0
any errors in the output? hellmatic 1523 — 6y
View all comments (6 more)
0
instead of Tool.Activated, do Mouse.Button1Down:connect(function() end) hellmatic 1523 — 6y
0
No errors on the output, I'll try the button1down. royee354 129 — 6y
0
Works but I do need the tool to be equipped for it to work, I don't want to just press. royee354 129 — 6y
0
Edited my answer. Replace your local script's code with mine. hellmatic 1523 — 6y
0
Doesn't work, probably because of the Equipped function? I don't think any of the tool's events work in FE? royee354 129 — 6y
0
All I had to do is to to make the bool of Required Handle to false. [SOLVED] royee354 129 — 6y
Ad

Answer this question