I have been posting a lot about this script lately, And I'm finishing it off by fixing one last bug. Basically when I cast it, if someone walks into it, it automatically puts itself on their head, is there a way to fix this? My code:
--made by commag
local ChatService = game:GetService("Chat")
local Plr = game.Players.LocalPlayer
local Char = Plr.Character
local TS = game:GetService("TweenService")
repeat wait() until Char
local PG = Plr.PlayerGui
local G = Instance.new("ScreenGui", PG)
local MF = Instance.new("Frame", G)
MF.Size = UDim2.new(0.2,0,0.2,0)
MF.Style = "DropShadow"
MF.Position = UDim2.new(0.8,0,0.8,0)
local EVal = Instance.new("StringValue", PG)
EVal.Value = "Unequipped"
local T = Instance.new("TextButton", MF)
T.BackgroundTransparency = 1
T.Size = UDim2.new(1,0,1,0)
T.Text = "Death Pillar: " .. EVal.Value
T.TextScaled = true
local M = Plr:GetMouse()
local Casting = false
----------
M.Button1Down:connect(function()
if Casting == false and EVal.Value == "Equipped" then
Casting = true
ChatService:Chat(Char, "I will cleanse this world...", "Green")
wait(2)
ChatService:Chat(Char, "With The Pillar Of Death!", "Green")
local Pillar = Instance.new("Part")
Pillar.Shape = "Cylinder"
Pillar.Size = Vector3.new(500,0.1,0.1)
Pillar.CFrame = CFrame.new(M.Hit.p - Vector3.new(0,M.Hit.y + 100,0)) * CFrame.Angles(0,0,math.rad(-90))
Pillar.TopSurface = "Smooth"
Pillar.BottomSurface = "Smooth"
Pillar.BrickColor = BrickColor.new("Really black")
Pillar.Transparency = 0.4
Pillar.Material = "Neon"
Pillar.Anchored = true
Pillar.CanCollide = false
wait()
Pillar.Parent = game.Workspace
local TIO = TweenInfo.new(
3,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
1,
true,
2
)
local Prop = {
Size = Vector3.new(500,50,50)
}
Pillar.Touched:connect(function(H)
if game.Players:GetPlayerFromCharacter(H.Parent) and H.Parent.Name ~= Plr.Name then
H.Parent:BreakJoints()
end
end)
local Tween = TS:Create(Pillar, TIO, Prop)
Tween:Play()
Tween.Completed:connect(function()
Pillar:Destroy()
end)
wait(10)
Casting = false
end
end)
T.MouseButton1Click:connect(function()
if EVal.Value == "Unequipped" and Casting == false then
EVal.Value = "Equipped"
elseif EVal.Value == "Equipped" and Casting == false then
EVal.Value = "Unequipped"
end
end)
while wait() do
T.Text = "Death Pillar: " .. EVal.Value
end
