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: Why do some script only work in studio and not in-game?

Previous Thread :: Next Thread 
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
31 Mar 2016 07:23 PM
read sub m8 n reply :)
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
31 Mar 2016 07:24 PM
because u are incorrectly using scripts or local scripts
Report Abuse
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
31 Mar 2016 07:36 PM
I don't think this script is wrong:

function onTouched(hit)
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end

script.Parent.Touched:connect(onTouched)

(its in a part and in a script)
Report Abuse
Void_Optics is not online. Void_Optics
Joined: 21 Mar 2016
Total Posts: 286
31 Mar 2016 07:41 PM
And yet you even managed to mess that up.

SetCore or whatever can only be used in a local script.
Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
31 Mar 2016 07:54 PM
If you want that to work, link that touched event to the player, and go from there. Not sure, but you might be able to modify the CoreGui with Player.PlayerGui:SetCoreGuiEnabled("All", false).

(Or whatever you want to make appear.)


Report Abuse
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
31 Mar 2016 07:54 PM
I also tried it on a local script m8
Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
31 Mar 2016 07:55 PM
Of course though, that player variable will have been obtained through the touched event.




Report Abuse
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
31 Mar 2016 07:58 PM
I never used the player variable
Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
31 Mar 2016 08:00 PM
script.Parent.Touched:connect(function(player)
player.PlayerGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) --no idea if this will work
end)
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
31 Mar 2016 08:02 PM
:SetCoreGuiEnabled has to be used on the client (in a localscript)

I'd suggest putting a localscript in StarterPlayerScripts and handling the .touched event from there
Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
31 Mar 2016 08:13 PM
Yeah. Like, Part in Workspace.
Script in Part.
And a disabled LocalScript inside of the Part.

LocalScript Code:
game.StarterGui:SetCoreGuiEnabled("All", false)

Script Code:

local Part = script.Parent
local LocalScript = script.Parent.LocalScript
function PartTouched(Leggy)
if Leggy.Parent ~= nil and Leggy.Parent:IsA("Model") then
local Character = Leggy.Parent
local Player = Character:GetPlayerFromCharacter()
local NewLocalScript = LocalScript:Clone()
NewLocalScript.Parent = Player.PlayerGui
NewLocalScript.Disabled = false
end
end
Part.Touched:connect(PartTouched(Leggy))

Something like that. Was testing out in Studio. Only thing I don't understand too much is the whole PlayerGui thing. You might have to work that out there.


Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
31 Mar 2016 08:14 PM
Oh, I was testing that out in Studio. That code is messed up... lemme fix that...


Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
31 Mar 2016 08:15 PM
local Part = script.Parent
local LocalScript = script.Parent.LocalScript
Part.Touched:connect(function(Leggy)
if Leggy.Parent ~= nil and Leggy.Parent:IsA("Model") then
local Character = Leggy.Parent
local Player = game.Players:FindFirstChild(Character.Name)
local NewLocalScript = LocalScript:Clone()
NewLocalScript.Parent = Player.PlayerGui
NewLocalScript.Disabled = false
end)

There. I think I fixed that stuff up. Definitely not going to work 100%, tho.


Report Abuse
Crimsonal is not online. Crimsonal
Joined: 23 Apr 2011
Total Posts: 1795
31 Mar 2016 09:13 PM
idk, i guess server a client work as one, but when the game is actually on, they are seperate
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
31 Mar 2016 09:21 PM
Correct, Crimsonal. Studio does simulate the differences when you start a Test Server though (The feature that can have 0 or more players and starts a separate window for each)
Report Abuse
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
01 Apr 2016 05:26 PM
Would this work in a local script if I make it that the tools become true if the humanoid's health is at 0??
Report Abuse
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
01 Apr 2016 05:35 PM
bumpidy bump bump
Report Abuse
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
01 Apr 2016 05:42 PM
hi
Report Abuse
YourWillPower is not online. YourWillPower
Joined: 14 Jul 2014
Total Posts: 535
09 Apr 2016 11:47 AM
^^^
Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
12 Apr 2016 03:23 PM
You gotta stop bumpin' this, man. Keeps popping up in my list. >:l


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