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: Works in Studio, but not in-game.

Previous Thread :: Next Thread 
sasuker4444 is not online. sasuker4444
Joined: 05 Nov 2011
Total Posts: 152
17 Oct 2017 04:01 PM
I've made a code that makes it so when touched your head transparency goes to 1 (Since I'm a ####### I'm trying to keep it easy.) and well it works all fine in studio, but breaks and doesn't work in-game...could anyone help ? ----------------------------------------CODE---------------------------------------------- local Hider = script.Parent local function On(part) local Parent = part.Parent if game.Players:GetPlayerFromCharacter(Parent)then Parent.Head.Transparency = 1 wait(.1) Parent.Head.Transparency = 1 end end Hider.Touched:connect(On)
Report Abuse
sasuker4444 is not online. sasuker4444
Joined: 05 Nov 2011
Total Posts: 152
17 Oct 2017 04:03 PM
local Hider = script.Parent

local function On(part)
local Parent = part.Parent
if game.Players:GetPlayerFromCharacter(Parent)then
Parent.Head.Transparency = 1
wait(.1)
Parent.Head.Transparency = 1
end

end

Hider.Touched:connect(On)



--(Better view of the code.)
Report Abuse
musickman14 is not online. musickman14
Joined: 27 Nov 2011
Total Posts: 979
17 Oct 2017 04:03 PM
Put it in a local script and try it again
Report Abuse
sasuker4444 is not online. sasuker4444
Joined: 05 Nov 2011
Total Posts: 152
17 Oct 2017 04:05 PM
Doesn't work at all now.
Report Abuse
musickman14 is not online. musickman14
Joined: 27 Nov 2011
Total Posts: 979
17 Oct 2017 04:07 PM
Try and put the local script in starter character and check output errors when trying different stuff
Report Abuse
sasuker4444 is not online. sasuker4444
Joined: 05 Nov 2011
Total Posts: 152
17 Oct 2017 04:11 PM
Wouldn't that remove the "On-touched" function ?
Report Abuse
musickman14 is not online. musickman14
Joined: 27 Nov 2011
Total Posts: 979
17 Oct 2017 04:15 PM
You can do game.Workspace.hider
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
17 Oct 2017 04:17 PM
local function touched(hit)
local char = hit:FindFirstAncestorOfClass("Model")
local hum = char and char:FindFirstChild("Humanoid")
if hum and hum.Health > 0 then
local plr = game.Players:GetPlayerFromCharacter(char)
if plr then
char.Head.Transparency = 1
end
end
end

script.Parent.Touched:Connect(touched)
Report Abuse
sasuker4444 is not online. sasuker4444
Joined: 05 Nov 2011
Total Posts: 152
17 Oct 2017 04:32 PM
Works now, thank you.
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