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

how to make the ball expand on contact?

The code.

local enabled = true
Player = script.Parent.Parent
character = Player.CharacterAdded:wait();
mouse = Player:GetMouse()

function onKeyDown(key)
	key = key:lower()
	if key == "x" then
		b = Instance.new ("Part")
		b.BrickColor = BrickColor.new("Bright violet")
		b.Shape = "Ball"
		b.Size = Vector3.new(3, 3, 3)
		b.TopSurface = "Smooth"
		b.BottomSurface = "Smooth"
		b.CanCollide = false
		b.Anchored = false
		b.CFrame = Player.Character.Torso.CFrame *CFrame.new(0, 0, -12)
		b.Parent = workspace
		game.Debris:AddItem(b,6)
		b2 = Instance.new("Part")
		b2.BrickColor = BrickColor.new("Lavender")
		b2.Shape = "Ball"
		b2.Size = Vector3.new(5, 5, 5)
		b2.TopSurface = "Smooth"
		b2.BottomSurface = "Smooth"
		b2.Transparency = 0.7
		b2.CanCollide = false
		b2.Anchored = false
		b2.CFrame = Player.Character.Torso.CFrame *CFrame.new(0, 0, -12)
		b2.Parent = b
		game.Debris:AddItem(b2,6)
		y = Instance.new("BodyVelocity")
		y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
		y.velocity = Player.Character.Torso.CFrame.lookVector*80
		y.Parent = b
		f = Instance.new("Fire")
		f.Size = 5
		f.Heat = 15
		f.Color = Color3.new(101, 101, 152)
		f.SecondaryColor = Color3.new(170, 170, 255)
		f.Parent = b		
		weld = Instance.new("Weld")
		weld.Part0 = b2
		--weld.C0 = b2.CFrame:inverse()
		weld.Part1 = b
		weld.Parent = b
	end
end

mouse.KeyDown:connect(onKeyDown)

I'm making fighting moves so you can imagine the effect i want.

1 answer

The mouse is only obtainable in LocalScripts. Make that script a LocalScript, then replace Player and mouse with Player, mouse = game.Players.LocalPlayer, game.Players.LocalPlayer:GetMouse()

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