Earth magic spikes

I was creating earth magic and I made spikes that come out of the ground with the same color and material

input - local script :

local re = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

	if input.KeyCode == Enum.KeyCode.E then
		local root = character:WaitForChild("HumanoidRootPart")
		local pos =, math.floor(root.Position.Y)-3,root.Position.Z) --make a grid at the Y position
		local orien =,root.Orientation.Y,0) --makes the spike angle not change if the character is down or standing


spike creation - script :

local re = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
local spike = game:GetService("ServerStorage"):WaitForChild("Spike")


	for i = 1,10 do --10 means how many spikes will be created
		local spike = spike:Clone()
		spike.Orientation = orien
		spike.Position = pos 
		spike.CFrame += spike.CFrame.LookVector *(4*i+i) --makes the thorn advance to its final position
		spike.Size =,4*i,2+i)
		spike.Position +=,spike.Size.Y/2 ,0) --makes the spike stay above ground

		local ray =,spike.Position.Y,spike.Position.Z) ,, -(2*i+.1), 0) ) --check the ray API
		local hit = workspace:FindPartOnRayWithIgnoreList(ray, {spike})

		if not hit then return end --if the spike is on the ground (if the ray hit something)
		spike.Color = hit.Color
		spike.Material = hit.Material
		spike.Orientation +=,0 ,math.random(-15,15)) --makes the spike vary its angle a little
		spike.Position +=,-((i+1)/2),0) --makes the spike go down a little and enter the ground

		spike.Anchored = true
		spike.Parent = workspace
		game.Debris:AddItem(spike,5) --destroy spike after 5 seconds

Shouldnt this be in #resources:community-resources ?
Also good job!


This looks like something that you play with in the old script builder games, great job


These look very similar to Elemental Battlegrounds’ “Aciculate Spikes” spell.
Did you base it off that?


Why is there an elseif but not an if in the local script?

1 Like

This looks very good, but I recommend putting raycast on client if you can.

1 Like

This was because within the event there were several input comparisons to other magic attacks , when I published this post I only put the spike magic input code and forgot to change elseif to if

I will change it now

couldn’t you also use :lerp()?

Wow, can I use this in my game? I would give credit.

1 Like

This is really cool! Also this is really useful for people trying to understand how to use CFrame in a script.

A nice resource, however I would like to give some feedback.

  • Use task.wait instead of wait since wait is deprecated
  • Use the new workspace:Raycast() instead of