|
| 05 Jan 2015 02:53 PM |
Hello! I am making a game, and I want to add a radio, that you have to buy with a gamepass. I can't seem to get a script where if you have a gamepass it gives you the radio.
I have this script, which works: game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) require(game:GetService("ReplicatedStorage"):WaitForChild("GiveRadio"))(player) end) end)
That script gives the radio to anyone who joins. Could someone help me implement a gamepass script into this? Thanks! |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 02:54 PM |
there's no point using GetService on ReplicatedStorage.
PlayerHasPass |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 02:57 PM |
| There is another script in replicatedStorage which makes it so the radio gets put onto your back. I am trying to do a Mad Murderer/Twisted Murderer radio. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Jan 2015 03:00 PM |
local passService = game.GamePassService -- i dont think you have to use getservice on this
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
if passService:PlayerHasPass(player, PassID) then
-- effect
end end)
end)
-- should work |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 03:04 PM |
I am a noob at scripting. My friend made the script to give the radio, but that is where it gives it to anyone who joins the game. I don't know how to implement the code that I put up there into your script. I am sorry if this is causing any trouble D:
Code that needs to implemented: game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) require(game:GetService("ReplicatedStorage"):WaitForChild("GiveRadio"))(player) end) end)
I don't know if the code up there needs to be scratched for the gamepass to work or not. |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 03:05 PM |
| DO I put the ID where it says ID in the ( )? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Jan 2015 03:11 PM |
| yes you put the game pass ID there |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 03:13 PM |
Should it look like this?
local passService = game.GamePassService -- i dont think you have to use getservice on this
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
if passService:PlayerHasPass(player, PassID) then game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) require(game:GetService("ReplicatedStorage"):WaitForChild("GiveRadio"))(player)
-- effect
end
end)
end)
|
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 03:15 PM |
One I posted above does not work...
I am using this radio: http://www.roblox.com/Twister-murderer-Radio-item?id=188622268
Maybe that will be helpful to you? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Jan 2015 03:19 PM |
no...
local passService = game.GamePassService -- i dont think you have to use getservice on this local radio = game.ReplicatedStorage.Radio
game.Players.PlayerAdded:connect(function(player)
if passService:PlayerHasPass(player, PassID) then
local c = radio:Clone() c.Parent = player.StarterGear
end
end)
|
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Jan 2015 03:22 PM |
| you should NEVER copy parts of one script into another |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 03:23 PM |
| Ok, that script did not work :/ I'm not sure if the link of the radio would help you or not. It is a model, and not a gear. The radio puts up a GUI and puts a radio model on your back. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 05 Jan 2015 03:29 PM |
first where did you test this? studios?
second i had no idea there was a Gui involved, that will take some changes to the script |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 03:32 PM |
| I put the script in studio, and then joined the game with Roblox player |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2015 03:39 PM |
Nevermind. The radio is broken.
I wanted a radio that puts a radio on your back, you put in an ID for audio, and then everyone around you can hear it. Just like the radios on Mad Murderer and Twisted Murderer. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
| |
|