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

How to make a touch button that can change server music & kill characters?

Asked by 6 years ago

Hi,

I am probably a lot less experienced than a beginner when it comes to scripting, so this might seem simple to a lot of people. I would like to know how to create a button that, once made contact with one player's character (not clicked, but touched), changes the whole server's music and resets all players. Then after 30 seconds, resets the music to its original music.

I don't even know how to begin writing this script, but would be very nice of you to give me a hand. I would also need to know where the script should go and what properties need to be changed if any. (I know where each category in Explorer is, but don't know which one/s I'll need to put the script in to create this)

Many thanks!

0
Don't ask or request. NexoKami 12 — 6y

3 answers

Log in to vote
0
Answered by 6 years ago

It is against the scripting helpers rules to ask for us to create a script for you, but I can point you in the right direction to find your feet in scripting. Try checking the Roblox wiki here if you are unsure in the future. These links may help you:

Audio

Killing players

And you may also want to look at these guides:

Getting Started

Turorials

Ad
Log in to vote
0
Answered by 6 years ago

Here is how you would do server music:

s = Instance.new("Sound")
s.Parent = game.Workspace
s.SoundId = "rbxassetid://000000000" -- Sound ID goes here
s.Volume = 1
s.IsPlaying = true
s.Looped = true

How to change it:

Assets = {00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000}
part = script.Parent
bool = true
function onTouch()
    bool = false
    if part:FindFirstChild(¨Humanoid¨) ~= nil then
         for _, asset in ipairs(Assets) do
             Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..asset)
    end
    wait(2)
    bool = true
end
part.Touched:Connect(onTouch)

As for killing the player:

part = script.Parent
player = game.Players:GetPlayerFromCharacter(part)
function onTouch()
    if player ~= nil then
        player.Humanoid.Health = 0
    end
end
part.Touched:connect(onTouch)

There you go.

0
When you change the audio, does it have to be in a separate script or the same one you used for the first section? If you have to create a new script, would I use LocalScript or just a Script? Thanks! PrincessPaige12345 -3 — 6y
0
@PrincessPaige12345 BRAH WE DONT WRITE SCRIPTS FOR U!! FIGURE IT OUT!! ITS CaLLED SCRIPTING HELPES NOT SCRIPTING GIVERS User#20192 0 — 6y
Log in to vote
-1
Answered by 6 years ago
Edited 6 years ago

ok i know how to add the "click button to change music script" but thats all first add your music to the game..add a sound..and edit the sound id so you have your own music. then add a script to the button ..this is the button that you want them to click to change the music

script.Parent.MouseButton1Click:connect(function(plr)
game.Workspace.Sound:Play()
wait(30)
plr:kill--this line might not work
end)

so this says when u click the button the sound plays..and it might kill player after 30 seconds.Hope i can help..Also...

Please dont send negative reviews on my awnser because im in the negatives and im trying to get back to 0...The reason why i dont ask questions is because people send negative reviews and puts me far in the negatives...im close to being back at 0 and i dont want spoilers ruining this..and if you can accept my awner :D

0
Not quite... turtle2004 167 — 6y
0
what User#20192 0 — 6y
0
if you listened this script plays the music wait 30 secnds then kills the players..be thankful because its illegal to write scripts for you User#20192 0 — 6y

Answer this question