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

Help with model scripting?

How to make a model appear instead of a part when you click? Do you ahve to place the model somewhere in the workspace? if not where do I have to place it? Here's a fireball script, but I want to change x with a model.

wait(3)
Player = script.Parent.Parent.Parent
n = script.Parent
local debounce = false
mouse = Player:GetMouse()
run = game:GetService("RunService")
function pizza(mouse)
	if debounce == false then
		game:GetService("Chat"):Chat(Player.Character.Head, "Fire Style : Fireball Jutsu")
		debounce = true
		Player.PlayerGui.Chakra.Clock.Value = Player.PlayerGui.Chakra.Clock.Value -100
			local x = Instance.new("Part")
			x.Shape = "Ball"
			x.CanCollide = false
			x.TopSurface = "Smooth"
			x.BottomSurface = "Smooth"
			x.Transparency = 0.45
			x.Parent = Workspace
			x.Size = Vector3.new(10, 50, 10)
			x.BrickColor = BrickColor.new("Bright red")
			x.Name = Player.Name
			y = Instance.new("BodyVelocity")
			y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
			y.velocity = Player.Character.Torso.CFrame.lookVector*110
			x.Parent = Workspace
			y.Parent = x
			f = Instance.new("Fire", x)
			f.Heat = 0
			f.Size = 12
			x.Touched:connect(function(Part) 
    if Part.Parent:FindFirstChild("Humanoid") ~= nil then
		script.Disabled = true
		for i = 1,20 do  
        Part.Parent.Humanoid.Health =  Part.Parent.Humanoid.Health -1
		wait(0.05)
		end
		wait(35)
		script.Disabled = false
    end
	wait(0.025)
end)
			x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 0, -10)
			game.Debris:AddItem(x, 10)

	end
	wait(35)
	debounce = false
end




function onSelected(mouse)
	mouse.Button1Down:connect(function() pizza(mouse) end)
end

n.Selected:connect(onSelected)
		

1 answer

I supposed you can store the Model as a child of the script, if that's possible. Then clone the model whenever needed. Try it out, but I suggest you take advice from someone more experienced.

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