Problem with trying to pick up a potion

As of now it will act as if it’s afire potion since it’s the only thing I wrote in that dictionary, you’ll have to add more functions in there yourself, first test out if my theory even works

1 Like

expected } to close { at line 12 got )

fixed it you don’t need the end) you just need end

My bad! I forgot to double check the code haha

1 Like

Correct it works, But how do i make it so if i throw a push potion it does the push effects and if fire potion do fire effects

Make functions in that potionfuctions dictionary, making sure the key is a name of a potion and replace

potionfunctions["Fire_Potion"](part)

with

potionfunctions[part.Name](part)

Basically how I did for the Fire Potion but change it up

1 Like

this gives me a error

local potionfunctions = {
	["Fire_Potion"] = function(part)
		local fire = game:GetService("ReplicatedStorage").Fire:Clone()						

		fire.Parent = workspace
		fire.Position = part.Position

		local time_ = 1

		local tween1 = tweenservice:Create(fire, TweenInfo.new(time_),{Size = Vector3.new(9,0.025,9)})
		tween1:Play()

		tween1.Completed:Wait()
		game:GetService("ServerScriptService").ItemSpawn.Spawned.Value -= 1
		part:Destroy()

		tween1.Completed:Wait()
		wait(1)
		fire:Destroy()	
	end
	
	["Push_Potion"] = function(part)
		local fire = game:GetService("ReplicatedStorage").Fire:Clone()						

		fire.Parent = workspace
		fire.Position = part.Position

		local time_ = 1

		local tween1 = tweenservice:Create(fire, TweenInfo.new(time_),{Size = Vector3.new(9,0.025,9)})
		tween1:Play()

		tween1.Completed:Wait()
		game:GetService("ServerScriptService").ItemSpawn.Spawned.Value -= 1
		part:Destroy()

		tween1.Completed:Wait()
		wait(1)
		fire:Destroy()	
	end
}

You forgot to add a comma between each of them

local potionfunctions = {
	["Fire_Potion"] = function(part)
		local fire = game:GetService("ReplicatedStorage").Fire:Clone()						

		fire.Parent = workspace
		fire.Position = part.Position

		local time_ = 1

		local tween1 = tweenservice:Create(fire, TweenInfo.new(time_),{Size = Vector3.new(9,0.025,9)})
		tween1:Play()

		tween1.Completed:Wait()
		game:GetService("ServerScriptService").ItemSpawn.Spawned.Value -= 1
		part:Destroy()

		tween1.Completed:Wait()
		wait(1)
		fire:Destroy()	
	end,
	
	["Push_Potion"] = function(part)
		local fire = game:GetService("ReplicatedStorage").Fire:Clone()						

		fire.Parent = workspace
		fire.Position = part.Position

		local time_ = 1

		local tween1 = tweenservice:Create(fire, TweenInfo.new(time_),{Size = Vector3.new(9,0.025,9)})
		tween1:Play()

		tween1.Completed:Wait()
		game:GetService("ServerScriptService").ItemSpawn.Spawned.Value -= 1
		part:Destroy()

		tween1.Completed:Wait()
		wait(1)
		fire:Destroy()	
	end
}
1 Like

Did I do something wrong?, I’m dumb.

You didn’t add a comma between the 2 keys, that’s why it was erroring, you need to separate each of them via a comma, like how you do with regular tables

yes that would probably be why LOL!

1 Like

I’m scared… what-what made this happen?!

I’m joking but i know why this is happening.

It’s probably cause there’s no debounce when the part is touched

its because tween didn’t exist

1 Like

Thank you for all the help today, Everything’s working now!

1 Like

I’m glad to be of extreme help to you! If you have anymore issues please don’t hesitate to make another post!

1 Like