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

Why doesn't the sword script work with FE?

Asked by
Viking359 161
6 years ago

I've made my own sword and when I test it w/o FE it works fine but with FE it doesn't work and there's no output error.

local player = script.Parent.Parent

local damage = script.Parent.Damage.Value

local attackspeed = 1

local target = "Humanoid"

local tool = script.Parent

local body = script.Parent.Handle

local attacking = false

local ready = true

local speed = attackspeed -.2

function swordUp()
    tool.GripForward = Vector3.new(-1,0,0)
    tool.GripRight = Vector3.new(0,1,0)
    tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
    tool.GripForward = Vector3.new(0,0,1)
    tool.GripRight = Vector3.new(0,-1,0)
    tool.GripUp = Vector3.new(-1,0,0)
end

local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = body
SlashSound.Volume = .7

local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = body
UnsheathSound.Volume = 1

function onEquipped()
    UnsheathSound:Play()
end
script.Parent.Equipped:Connect(onEquipped)

script.Parent.Handle.Touched:Connect(function (hit)
if attacking == true and hit.Parent:FindFirstChild(target) then
local humanoid = hit.Parent:FindFirstChild(target)
    local vCharacter = tool.Parent
    local vPlayer = game.Players:playerFromCharacter(vCharacter)
    local hum = vCharacter:FindFirstChild("Humanoid")

        tagHumanoid(humanoid, vPlayer)
        humanoid:TakeDamage(damage)
        wait(1)
        untagHumanoid(humanoid)
    end
end)

function tagHumanoid(humanoid, player)
    local creator_tag = Instance.new("ObjectValue")
    creator_tag.Value = player
    creator_tag.Name = "creator"
    creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
    if humanoid ~= nil then
        local tag = humanoid:findFirstChild("creator")
        if tag ~= nil then
            tag.Parent = nil
        end
    end
end

function onKeyPress(actionName, userInputState, inputObject)
    if userInputState == Enum.UserInputState.Begin and ready == true then
local ready = false
local attacking = true
    swordOut()
    SlashSound:Play()
    wait(.2)
    swordUp()
local attacking = false
    wait(speed)
local ready = true
    else
        wait(0)
    end
    end

game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.Q)

It won't even change the grip. This is a server script directly inside a tool that's in the player's starterpack.

0
in Filtering Enabled, you script differently PhoenixVortex_RBLX 33 — 6y
0
Very undescriptive @PhoenixVortex_RBLX hiimgoodpack 2009 — 6y
0
I know you have to script differently but I dont know what to change. Viking359 161 — 6y

Answer this question