generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Local Script not working in-game...

Previous Thread :: Next Thread 
PhantomVisual is online. PhantomVisual
Joined: 08 Apr 2011
Total Posts: 2025
10 Jul 2016 11:59 PM
local player = game:GetService("Players").LocalPlayer

game.Workspace:WaitForChild(player.Name)

local d = game.Workspace[player.Name]:GetChildren()

for i=1, #d do
if (d[i].className == "Part" and d[i].Name ~= "HumanoidRootPart") then --gets all parts in player
d[i].Transparency = SPECTER_TRANSPARENCY --half visible
d[i].BrickColor = BrickColor.new(SPECTER_COLOR) --player turns white
end
end

ty for the help!


https://www.roblox.com/Donald-Trump-Says-China-item?id=328461041
Report Abuse
PhantomVisual is online. PhantomVisual
Joined: 08 Apr 2011
Total Posts: 2025
11 Jul 2016 12:08 AM
This works in ROBLOX Studio as well...


https://www.roblox.com/Donald-Trump-Says-China-item?id=328461041
Report Abuse
RealityBender is not online. RealityBender
Joined: 05 Mar 2016
Total Posts: 43
11 Jul 2016 12:10 AM
is it a local script?
Report Abuse
doggy00 is not online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
11 Jul 2016 12:10 AM
I know sometimes if it works in studio but not in-game then it will work in-game by using a normal script rather than a local one, but you're probably using a local script for a reason so I don't know what to tell you.


--game.Players.doggy00.Life:remove() error- Life is not a valid member of Player
Report Abuse
PhantomVisual is online. PhantomVisual
Joined: 08 Apr 2011
Total Posts: 2025
11 Jul 2016 12:12 AM
It has to be a local script because I have FE enabled...


https://www.roblox.com/Donald-Trump-Says-China-item?id=328461041
Report Abuse
RealityBender is not online. RealityBender
Joined: 05 Mar 2016
Total Posts: 43
11 Jul 2016 12:17 AM
FE is the cuase.
just disable FE
or you could use server script to do it if you want FE (You have to pass the LocalPlayer to the server)
Report Abuse
doggy00 is not online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
11 Jul 2016 12:19 AM
rem


--game.Players.doggy00.Life:remove() error- Life is not a valid member of Player
Report Abuse
PhantomVisual is online. PhantomVisual
Joined: 08 Apr 2011
Total Posts: 2025
11 Jul 2016 12:20 AM
FE has to be on though, because I want the person who has the script to see themselves.


https://www.roblox.com/Donald-Trump-Says-China-item?id=328461041
Report Abuse
RealityBender is not online. RealityBender
Joined: 05 Mar 2016
Total Posts: 43
11 Jul 2016 12:28 AM
so your script is to make the character only visible on the player's client?
Report Abuse
PhantomVisual is online. PhantomVisual
Joined: 08 Apr 2011
Total Posts: 2025
11 Jul 2016 12:30 AM
Yes.


https://www.roblox.com/Donald-Trump-Says-China-item?id=328461041
Report Abuse
PhantomVisual is online. PhantomVisual
Joined: 08 Apr 2011
Total Posts: 2025
11 Jul 2016 01:01 AM
Bump...


https://www.roblox.com/Donald-Trump-Says-China-item?id=328461041
Report Abuse
njesk12 is online. njesk12
Joined: 21 Aug 2012
Total Posts: 65
11 Jul 2016 01:44 AM
Your problem here is that you are attempting to change server-side values with a local script... with FE enabled. Here's what you should do. Anything in your script that changes you character should be placed in a global script who's parent is the Workspace, and has a remote event child. Now you simply call the remote event and fire the server. Create an OnServerEvent function from the local script and allow the global scripts to make the changes instead.

You have to remember that a local script is LOCAL and can only change LOCAL attributes, whereas a GLOBAL script can change GLOBAL attributes. This is especially important to know when having FE. If you need help with more of this, learn more about Remote Events and Remote Functions here: http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial

Also, watch this video which helped me A LOT when I first began learning LUA: https://www.youtube.com/watch?v=C0qQ4lDa3t0
Report Abuse
Twister_1976 is not online. Twister_1976
Joined: 17 Sep 2010
Total Posts: 2494
11 Jul 2016 01:54 AM
I'll rewrite this because I'm bored.
Make sure there is a RemoteEvent in ReplicatedStorage named "SpecterChange".

--A regular script in ServerScriptService.
local rep = game:GetService("ReplicatedStorage")
local change = rep:WaitForChild("SpecterChange")

change.OnServerEvent:connect(function(plr)
change:FireAllClients(plr)
end)

--A localscript in StarterPlayerScripts
local rep = game:GetService("ReplicatedStorage")
local change = rep:WaitForChild("SpecterChange")

local function ChangeCharacter(player)
if (not player.Character or player == game:GetService("Players").LocalPlayer) then return end

for i, v in pairs(player.Character:GetChildren()) do
if (v:IsA("BasePart")) then
v.Transparency = 0.5
v.Color = Color3.new(255,255,255)
end
end
end

change.OnClientEvent:connect(ChangeCharacter)

[SOMEWHERE ELSE]: change:FireServer()
--Note the player fireing the FireServer will be the specter and this code isn't tested.

If money grew on trees... It would be as valuable as leaves. | Twitter: @TwisterRBLX


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image