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

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

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

✓ Accepted answer

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.

5 comments

0

21:44:44.030 - Players.OniSanYamate.Backpack.Emit:35: 'end' expected (to close 'function' at line 9) near ''

0

Oh. Ifixed it

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))

0

^ Oh, I never thought of it like that. Both ways still work though, right?

0

you didnt put end didnt you lol

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