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

How do i make ablock when i step on it it will make a sound and cframe?

Asked by 9 years ago

I have tried this but none of it worked,none of it.

if part.Ontouched then
part.CFrame = part.CFrame.new (42, 0.59, 49)
msc = Instance.new("Sound", Workspace)
msc.SoundId="http://www.roblox.com/asset/?id=131111368"
while true do
    wait(10)
    msc:Play()
end

2 answers

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
9 years ago

You forgot a connection line for your player. Tip: Not everything that touches the part will always be a player. Also, you included a loop for no reason.

on = false

script.Parent.Touched:connect(function(hit)
    if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then
    if not on then
        on = true
        part.CFrame = part.CFrame.new (42, 0.59, 49)
        msc = Instance.new("Sound", script.Parent)
        msc.SoundId = "http://www.roblox.com/asset/?id=131111368"
        wait()
        msc:Play()
        wait(10)
        msg:Stop()
        on = false
    end
    end
end)
0
Forget the awnser below your one.That one is telling me how to do nothing! iluvmaths1123 198 — 9y
0
If I helped you out, accept my answer/bump up my reputation! Shawnyg 4330 — 9y
Ad
Log in to vote
-2
Answered by 9 years ago

Where is ur connection line, is this the whole script?

0
What are connection lines don't expect me to know? iluvmaths1123 198 — 9y

Answer this question