Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Sound not playing after being cloned?

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

3 comments

0

Can we see the full script?

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.

0

Added it

2 answers

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

2 comments

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

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!?!?!?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.