Scripting Entry

View previous topic View next topic Go down

Scripting Entry

Post by Zzzip42Strike on Sun Jun 02, 2013 5:47 pm

I heard Jobro say that he needs some help with tools.

I think I am good at both building, and coding tools.

To prove this, here is a script I made for Script Builders on my 7th day of ever learning how to script. Its kind of annoying because people accuse me of pasting a free forum script, but then again, I take that as it must be somewhat refined for it to be branded like that.

Yes I am offering my favorite script to be turned into a free script. Go try it out and tell me how well you judge it on its design and refinedness.


user = "Zzzip42Strike"

game:GetService("Players"):findFirstChild(user).Chatted:connect(function(msg)

if msg == "Clean" then
script.Parent:Destroy()

end
end)

mode = "Beam"
firing = false


h = Instance.new("Tool", game:GetService("Players"):findFirstChild(user).Backpack)
h.Enabled = true
h.Name = "Azure Flare of Soulburn"

shaft = Instance.new("Part", h)
shaft.Size = Vector3.new(1, 5, 1)
shaft.Name = "Handle"
shaft.CanCollide = false
shaft.BrickColor = BrickColor.new("Really black")
local mesh = Instance.new("CylinderMesh", shaft)
mesh.Scale = Vector3.new(.3, 1, .3)

plate = Instance.new("Part", h)
plate.FormFactor = "Custom"
plate.Size = Vector3.new(1.5, 0.1, 1.5)
plate.Name = "Handle"
plate.CanCollide = false
plate.BrickColor = BrickColor.new("Really black")
local mesh = Instance.new("CylinderMesh", plate)
mesh.Scale = Vector3.new(1, 0.3, 1)

local band1 = Instance.new("Part", h)
band1.Size = Vector3.new(1, 2, 1)
band1.Name = "Band"
band1.CanCollide = false
band1.BrickColor = BrickColor.new("Institutional white")
local mesh = Instance.new("CylinderMesh", band1)
mesh.Scale = Vector3.new(.4, 1, .4)

local band2 = Instance.new("Part", h)
band2.Size = Vector3.new(1, 1, 1)
band2.CanCollide = false
band2.Name = "Band"
band2.BrickColor = BrickColor.new("New Yeller")
local mesh = Instance.new("CylinderMesh", band2)
mesh.Scale = Vector3.new(.5, .6, .5)

local crys1 = Instance.new("Part", h)
crys1.Size = Vector3.new(1, 1, 1)
crys1.CanCollide = false
crys1.Name = "Crys1"
crys1.BrickColor = BrickColor.new("Cyan")
crys1.TopSurface = "Smooth"
crys1.BottomSurface = "Smooth"
crys1.Reflectance = .4
local sparx = Instance.new("Sparkles",crys1)
local f = Instance.new("Fire")
f.Size = 1
f.Heat = 30
f.Name = "f"
f.Color = BrickColor.new("New Yeller").Color
f.Parent = crys1

local crys2 = crys1:Clone()
crys2.Parent = h
crys2.Name = "Crys2"

local w1 = Instance.new("Weld",shaft)
w1.Part0 = w1.Parent
w1.Part1 = crys1
w1.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 45) * CFrame.new(0, -3.45, 0)

coroutine.resume(coroutine.create(function()
while true do
for x = 1, 360, 1 do
w1.C1 = w1.C1 * CFrame.Angles(0,math.rad(x),0)
wait(.025)
end
wait()
end
end))


local w2 = Instance.new("Weld",crys1)
w2.Part0 = w2.Parent
w2.Part1 = crys2
w2.C1 = CFrame.fromEulerAnglesXYZ(45, 45, 0) * CFrame.new(0, 0, 0)

local w3 = Instance.new("Weld",shaft)
w3.Part0 = w3.Parent
w3.Part1 = band1

local w3 = Instance.new("Weld",shaft)
w3.Part0 = w3.Parent
w3.Part1 = band2

local w4 = Instance.new("Weld",shaft)
w4.Part0 = w4.Parent
w4.Part1 = plate
w4.C1 = CFrame.new(0, -2.4, 0)

--Part Template

p = Instance.new("Part")
p.Size = Vector3.new(1, 1, 1)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.Transparency = .5
p.BrickColor = BrickColor.new("Cyan")
p.CanCollide = false
p.Anchored = true

local mesh = Instance.new("BlockMesh")

mesh.Parent = p
mesh.Scale = Vector3.new(1,4,1)

local sparx = Instance.new("Sparkles",p)

local f = Instance.new("Fire",p)
f.Size = 3
f.Heat = 30
f.Color = BrickColor.new("New Yeller").Color

--onTouch

function onTouched(hit)

local h = hit.Parent:findFirstChild("Humanoid")

if h ~= nil and hit.Parent.Name ~= user then

for i = 1, 10, 1 do
hit.Transparency = i * .1
wait(.05)
end
wait(1)
hit:Destroy()

end
end

--Begin key change--

script.Parent = h

function onKeyDown(key)

if key == "b" then

mode = "Beam"

elseif key == "c" then

mode = "Circle"

elseif key == "r" then

mode = "Rise"

elseif key == "e" then

mode = "Encircle"

elseif key == "l" then

mode = "Light"

end
end

--Begin Spells--

function onButton1Down()

local attractor = workspace:findFirstChild(user).Torso.CFrame

if firing == false then
firing = true
if mode == "Beam" then

coroutine.resume(coroutine.create(function()
for i = 4, 360, 2 do
local part = p:Clone()
part.Parent = workspace
game:GetService("Debris"):AddItem(part, 5)
part.Touched:connect(onTouched)

part.CFrame = attractor * CFrame.Angles(0,0, math.rad(i)) * CFrame.new(0, 0, -(i))

wait()
end
end))

wait(3)
firing = false

elseif mode == "Circle" then

coroutine.resume(coroutine.create(function()
for i = 4, 1440, 4 do
local part = p:Clone()
part.Parent = workspace
game:GetService("Debris"):AddItem(part, 5)
part.Touched:connect(onTouched)

part.CFrame = attractor * CFrame.Angles(0,math.rad(i), math.rad(i)) * CFrame.new(0, 0, 3+(i/16))

wait()
end
end))

wait(6)
firing = false


elseif mode == "Rise" then

coroutine.resume(coroutine.create(function()

for i = 1, 40, 1 do
local part = p:Clone()
part.Parent = workspace
part.Anchored = false
part.Size = Vector3.new(10, 100, 10)
part.Touched:connect(onTouched)

part.Anchored = true
part.CFrame = attractor.CFrame.p * CFrame.new(math.random(-50,50), -20, math.random(-50,50))

coroutine.resume(coroutine.create(function()

for i = 1, 40, 1 do

part.CFrame = part.CFrame * CFrame.new(0, i, 0)

wait()

end
part:Destroy()
end))

wait(.5)
end
end))

wait(7)
firing = false

elseif mode == "Enci" then

local p = Instance.new("Part")
p.Size = Vector3.new(25,30,1)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.BrickColor = BrickColor.new("Cyan")
p.Parent = workspace
p.FormFactor = "Symmetric"
p.CFrame = CFrame.new(0, -40, 0)

local mesh = Instance.new("BlockMesh")

mesh.Parent = p
mesh.Scale = Vector3.new(1,4,1)

local sparx = Instance.new("Sparkles")
sparx.Parent = p

local f = Instance.new("Fire")
local b = BrickColor.new("New Yeller")
local c = b.Color
f.Size = 3
f.Heat = 30
f.Name = "f"
f.Color = c
f.Parent = p

coroutine.resume(coroutine.create(function()

Bricks = 10

for i = 0, Bricks do
local part = p:Clone()
part.Parent = workspace
game:GetService("Debris"):AddItem(part, 5)
part.Touched:connect(onTouched)

part.Anchored = true
part.CFrame = attractor * CFrame.Angles(0,i * -math.pi/Bricks*2,0) * CFrame.new(0,0,7)
wait()
end

local f = Instance.new("ForceField", workspace:findFirstChild(user))
game:GetService("Debris"):AddItem(f, 7)
end))

wait(7)
firing = false

elseif mode == "Light" then

m = Instance.new("Model", workspace)
pos = workspace:findFirstChild(user).Head.Position
for x = -360, 0, 32 do
for y = 8, 360, 60 do
local part = p:Clone()
part.Size = Vector3.new(2, 2, 2)
part.Parent = m
part.Touched:connect(onTouched)
part.CFrame = attractor * CFrame.Angles(math.rad(y),math.rad(y), math.rad(x)) * CFrame.new(0, 0, 3)

wait()
end
wait()
end

local ball = p:Clone()
ball.Parent = workspace
ball.Size = Vector3.new(3,3,3)
ball.Shape = "Ball"
ball.Transparency = .2
ball.Anchored = true
ball.CFrame = attractor
local mesh = Instance.new("SpecialMesh")
mesh.MeshType = 3
mesh.Parent = ball
mesh.Scale = Vector3.new(2,2,4)
game:GetService("Debris"):AddItem(ball, 10)

local sparx = Instance.new("Sparkles")
sparx.Parent = ball

local f = Instance.new("Fire",ball)
f.Size = 20
f.Heat = 30
f.Color = BrickColor.new("New Yeller").Color

for index, child in pairs(m:GetChildren()) do

child:Destroy()

wait()

end

ball.Touched:connect(onTouched)

local bp = Instance.new("BodyPosition")
bp.position = Vector3.new(0, 5, 0)
bp.maxForce = Vector3.new(0, math.huge, 0)
ball.CFrame = attractor * CFrame.new(0,0,-7)
ball.Velocity = ((ball.Position - pos).unit) * 100
bp.Parent = ball
ball.Anchored = false

coroutine.resume(coroutine.create(function()
wait(.2)
mesh:Destroy()
for i = 2, 40, 1 do
ball.Size = Vector3.new(i, i, i)
ball.CFrame = ball.CFrame * CFrame.new(0, -(i/2), 0)
wait()
end
end))

wait(10)
firing = false

else

firing = false

end
end
end
--End Spells--


function OnEquipped(mouse)

mouse.Button1Down:connect(onButton1Down)

mouse.KeyDown:connect(onKeyDown)

end

script.Parent.Equipped:connect(OnEquipped)
function OnUnequipped()

mode = "Beam"

end

script.Parent.Equipped:connect(OnEquipped)
script.Parent.Unequipped:connect(OnUnequipped)

Zzzip42Strike

Posts : 26
Join date : 2013-06-02

View user profile

Back to top Go down

Messy

Post by Xulp on Sun Jun 02, 2013 10:24 pm

No offense, but I can't read that, and I'm a very experienced scripter. Try using capitals and indenting lines. It makes it easier to read.

_________________
Xulp - Building Moderator
avatar
Xulp

Male Posts : 60
Join date : 2013-06-02
Location : 'Murica

View user profile

Back to top Go down

Re: Scripting Entry

Post by jobro13 on Mon Jun 03, 2013 3:15 am

I don't think that Script Builder scripts are the same as "normal Rbx.Lua" scripts, but you have proved that you can handle the Lua syntax.

I guess that's a join acceptation.
avatar
jobro13

Male Posts : 250
Join date : 2013-06-02

View user profile

Back to top Go down

Re: Scripting Entry

Post by Zzzip42Strike on Mon Jun 03, 2013 5:47 am

It said show something you've made, and sorry, I didn't really have time atm to make anything complex to show.

Zzzip42Strike

Posts : 26
Join date : 2013-06-02

View user profile

Back to top Go down

Re: Scripting Entry

Post by Zzzip42Strike on Mon Jun 03, 2013 5:51 am

Also xulp, I made it while hanging out with my friends in a script builder, and my computer crashes if I use it with a game, so I had to use Notepad.

Also, why isn't it considered a script just because I load it in a game?

Zzzip42Strike

Posts : 26
Join date : 2013-06-02

View user profile

Back to top Go down

Re: Scripting Entry

Post by Zzzip42Strike on Mon Jun 03, 2013 5:56 am

Oyeah, I do have an actual thing. On my primary game theres a tool that looks like a guest that shows a draggable gui. It's a voodoo doll, and it targets when you touch the voodoo to another humanoid. Then you can control them with the attacks on the droplist. I've only made the Razor Blade work, and I'm planing to turn the others into empty so my friends can put their own in.

Zzzip42Strike

Posts : 26
Join date : 2013-06-02

View user profile

Back to top Go down

Re: Scripting Entry

Post by jobro13 on Tue Jun 04, 2013 5:27 am

I don't want to sound offensive, but you can use the edit button to edit your posts Smile

The script looks good, but the only thing is that "this" kind of scripts aren't used a lot in actual scripts - as you can :Clone most things. Not that it does matter tough.

As I said, welcome to the team.
avatar
jobro13

Male Posts : 250
Join date : 2013-06-02

View user profile

Back to top Go down

Re: Scripting Entry

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum