Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I want my seed script only be planted when on touch on ground. Please help?

Asked by 5 years ago
Edited 5 years ago

So, I don't know how to use IsDescendantOf yet. So I am having problems that my seed can be planted on mid-air. I want my seed script functions when on touch on ground, and whether I use IsDescendantOf. It also won't touch the legal part to be planted. Please help? Without using the Touched Event? The seed will float on air and later be a plant which is so higher. And my seed script can be planted on different materials that in real life that real seeds won't be planted on different materials (except soil). So the player might complain why the seed can be planted in mid-air or in different materials or be confused that why the seed can be planted in different materials.

Script:

local t = game:GetService("TweenService")
local mouse = game.Players.LocalPlayer:GetMouse()
local pi = 3.14159265359
script.Parent.Deactivated:Connect(function()
    local oldseed = script.Parent
    local seed = script.Parent.Handle:Clone()
    seed.Parent = game.Workspace
    seed.CFrame = game.Players.LocalPlayer.Character.Starling_Seed.Handle.CFrame
    local explosion = Instance.new("Explosion", seed)
    mouse.Move:Connect(function()
        explosion.Position = Vector3.new(mouse.Hit.p.X, 0, mouse.Hit.p.Z)
    end)
    explosion.BlastRadius = pi
    print("Planted")
    seed.CanCollide = false
    wait(0.2)
    seed.Anchored = true
    oldseed:Destroy()
    wait(5)
    seed.Anchored = false
    local Mesh =  seed
    local boduy = Instance.new("BodyPosition", Mesh)
    boduy.MaxForce = Vector3.new(2000, 2000, 2000)
    boduy.Position = Vector3.new(seed.CFrame.X,100,seed.CFrame.Z)
    wait(2)
    Mesh.Anchored = true
    boduy:Destroy()
    while true do
        wait(5)
        local goal = {}
        goal.Size = Vector3.new(100.5, 50.96, 100.751)
        goal.Orientation = Vector3.new(90, game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.Y,90)
        goal.Color = Color3.fromRGB(255,0,0)
        local g = t:Create(Mesh, TweenInfo.new(50), goal)
        g:Play()
        wait(40)
        local newseed = game.Lighting.CloneSeedFruit.Starling_Seed:Clone()
        newseed.Handle.CFrame = Mesh.CFrame
        newseed.Parent = game.Workspace
        print("Cloned Seed!")
        g:Pause()
            local explosion3 = Instance.new("Explosion", seed)
            mouse.Move:Connect(function()
            explosion3.Position = Vector3.new(mouse.Hit.p.X, 0, mouse.Hit.p.Z)
        end)
        explosion3.BlastRadius = pi
        wait(3)
        explosion3:Destroy()
        explosion:Destroy()
    end
end)
0
Can you write it more simply please,this is kinda confusing. tobhyyy 26 — 5y
0
Send script :/ legitbacon682 -5 — 5y

Answer this question