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

What's wrong with this Team Starterpack Script?

I wrote this script a while back, and it used to work fine. But now for some reason, it doesn't work. Basically, it's supposed to give the Player a weapon based on the team they're on. It's a regular script, and it's stored in StarterPack. Filtering enabled is on.

local AXISWeapons={'MP40'};
local ALLIEDWeapons={'Thompson'};

--repeat wait(.02) until script.Parent.Parent and game:GetService('ServerStorage')

local Player,SerStorage=script.Parent.Parent,game:GetService('ServerStorage');

if Player.TeamColor==BrickColor.new('Bright red') then --When being Axis
for _,v in pairs(AXISWeapons) do
SerStorage:FindFirstChild(v):Clone().Parent=script.Parent
end

elseif Player.TeamColor==BrickColor.new('Bright green') then --When being Allied
for _,v in pairs(ALLIEDWeapons) do
SerStorage:FindFirstChild(v):Clone().Parent=script.Parent
end end

3 answers

Assuming its a local script, local scripts cannot read or write (interact) to ServerStorage only regular scripts. To fix this I would suggest storing the items in ReplicatedStore because both client and server can interact with this storage space.

1 comment

0

It is a regular script, not a local script.

With Filtering Enabled on Server-Scripts(Regular Script) don't work in client side. I would suggest you change it to a LocalScript however, that would not work either because you're using FilteringEnabled... So I'd say use a RemoteEvent and activate the LocalScripts by using the RemoteEvents.... Client side is StarterPack and StarterGui and StarterPlayer 'cause it's on the device's side. So I advise you change it to LocalScript and use a RemoteEvent to activate it if you want to learn more about RemoteEvents then here is the link for it..

Link for RemoteEvents:

http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial

Well, I hope I helped and I was facing the same issue not too long ago however, I just stopped using FE it causes too much trouble. Thank you for reading this answer and if you have a question please post it in the comments below or contact me on Roblox! Have a nice day/night.

~~ KingLoneCat

1 comment

0

Guess I'll have to use a remote function or something..

Ehm, there's an easier way. Put the tools you want to lead into the teams, inside the team.

Put the tools in game.Teams.TheTeamYouWantTheToolsToLoadIn

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