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

What is the problem? The if or the else? or What?

Asked by 6 years ago
Edited 6 years ago

idk what is the problem on my if condition or anything that will make the script not to work. this is the if and else

    if EmitPartiClone.Parent == char.RightHand or char.LeftHand then
        ready = false
    else
        ready = true

and this is the whole Local Script.

math.randomseed(tick())
local input = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local animations = {1774809857}

local ready = true

local function emit(inputObject)
    if inputObject.KeyCode == Enum.KeyCode.LeftAlt and ready then
        local char = player.Character
        local hum = char.Humanoid
        local animation = Instance.new("Animation")
        local picked = 1
        animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
        local AnimaTrack = hum:LoadAnimation(animation)
        AnimaTrack:Play()
        ready = true
        wait(.8)
        local Emitparticle = script.ParticleEmitter
        local EmitPartiClone = Emitparticle:Clone()
        EmitPartiClone.Parent = char.RightHand
        wait()
        local EmitPartiClone = Emitparticle:Clone()
        EmitPartiClone.Parent = char.RightHand      
        EmitPartiClone.Parent = char.LeftHand
    if EmitPartiClone.Parent == char.RightHand or char.LeftHand then
        ready = false
    else
        ready = true
    end
end


input.InputBegan:connect(emit)

1 answer

Log in to vote
1
Answered by 6 years ago

You’ll have to do something like this for the conditional statement :

if EmitPartiClone.Parent == char.RightHand or EmitPartiClone.Parent == char.LeftHand then
    ready = false
else
    ready = true

Doing char.LeftHand only I think just checks if it exists or not, not where it’s parented.

0
21:44:44.030 - Players.OniSanYamate.Backpack.Emit:35: 'end' expected (to close 'function' at line 9) near '<eof>' OniSanYamate -17 — 6y
0
Oh. Ifixed it OniSanYamate -17 — 6y
1
You dont need to use an if statment just to assing a boolean use ready = (EmitPartiClone.Parent == char.RightHand or EmitPartiClone.Parent == char.LeftHand)) User#5423 17 — 6y
0
^ Oh, I never thought of it like that. Both ways still work though, right? User#20279 0 — 6y
0
you didnt put end didnt you lol radusavin366 617 — 6y
Ad

Answer this question