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

Sound not playing after being cloned?

Asked by
sigve10 94
8 years ago

I have made a script that will turn any block into a teletubby, then make them sing the teletubby song, but sadly, they WON'T FRICKING SING (sry 'bout that...)!

Here is my script:

game.ContentProvider:Preload("http://www.roblox.com/asset/?id=275347097")

game.ContentProvider:Preload("rbxassetid://183730399")

local colors = {
    "Br. yellowish green",
    "Bright yellow",
    "Bright red",
    "Royal purple"
}

script.Parent["Tubbytronic Superdome"].MainDome.Sound:Play()

math.randomseed(tick())
script.Parent.Enter.Touched:connect(function(hit)
    if hit:FindFirstChild("Cash") then
        hit.Cash.Value = math.floor(hit.Cash.Value ^ 2)
        local parentvalue = Instance.new("ObjectValue",script)
        parentvalue.Value = hit.Parent
        hit.Parent = nil
        script.Face:Clone().Parent = hit
        hit.BrickColor = BrickColor.new(colors[math.random(1,#colors)])
        local antenna = script:FindFirstChild(tostring(hit.BrickColor)):Clone()
        antenna.Parent = hit
        for i,v in pairs (antenna:GetChildren()) do
            v.Anchored = false
            v.CFrame = CFrame.new(v.CFrame.X, v.CFrame.Y + hit.Size.Y, v.CFrame.Z)
            local weld = Instance.new("Weld", v)
            weld.Part0 = hit
            weld.Part1 = v
            weld.C1 = CFrame.new(0, (-hit.Size.Y/4)*3, 0) * CFrame.Angles(0,math.pi/2,0)
            v.Transparency = 0
        end

        ----=== Main Sound Part ===----

        local sound = script.Sound:Clone()
        sound.Parent = hit
        sound:Play()
        sound.TimePosition = math.random(0,(sound.TimeLength - 0.6)*10000)/10000
        sound.Pitch = math.random(500,1500)/1000

        ----===                           ===----

        hit.Parent = parentvalue.Value
        parentvalue:Destroy()
        hit.CFrame = script.Parent.Leave.CFrame
        for i,v in pairs (script.Parent.Windmill[" Wind"].Union:GetChildren()) do
            v.Enabled = true
        end
        local scropt = script.TubbyScript:Clone()
        scropt.Parent = hit
        scropt.Disabled = false
        wait(0.1)
        for i,v in pairs (script.Parent.Windmill[" Wind"].Union:GetChildren()) do
            v.Enabled = false
        end
        wait(0.9)
        hit.Parent = parentvalue.Value
        parentvalue:Destroy()
        hit.CFrame = script.Parent.Leave.CFrame
    end
end)

and also: There is no output

Edit: Added whole script

0
Can we see the full script? koolkid8099 705 — 8y
0
math.random doesn't work with decimals. This also has to be connected to a TouchedEvent. Us seeing the whole script would help a lot. Thank you. User#11440 120 — 8y
0
Added it sigve10 94 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

well the script dosent even put it into the workspace and plus you need to make clone into the workspace allow playonremove and then script it to remove it there that should work and i dont know how to script it but if you do the basics and visuals then you can do it

0
First of all, Grammar (essential.) Second: It is in the workspace, but it is inside a descendant. Third: You do not need playonremove to actually play a sound. This is uncontrolled and not what I am looking for. The problem isn't the location or anything like that, but rather that the sound doesn't play, with no errors in the script. I tried doing it from another script, but that didn't work. Try sigve10 94 — 8y
0
Who cares about grammar this is about helping not grammar and i tried to forget school for the weekend and NOW YOU MADE MY DAY BAD ARE YOU HAPPY!?!?!? wiktorwiktor12 0 — 8y
Ad
Log in to vote
-1
Answered by 8 years ago

well use hit as a parameter it might not work but try

Answer this question