Hello, I’m making a football game that lets you change the power of shooting the ball.
I created a value with power set as 10 as default. In a localscript.
But when I try to access it with a serverscript, it says it can’t find it, while when i type the same line of code in the ‘Run a command’ bar it does work. I can see that it is in my character and it seems to work fine when the value is in workspace. Could anyone help me, I can provide the whole script if needed.
Thanks,
DanielosthebestYTalt
Is it perhaps because of the kind of value? All I need is numbers ranging from 0 - 200.
I’ve tried number and intvalues.
Avzycx
(flawless)
December 29, 2022, 5:41pm
#3
Depends on the script error, does it say that the value is nil?
An event might run before the game is loaded, is there a script error in the output?
Yes, when I go into current client mode, it doesn’t show the value, while I used a script to put it in.
The error message is:
’
Value is not a valid member of Model “Workspace.Danielosthebest”
’
EgizianoEG
(Egiziano)
December 29, 2022, 5:45pm
#5
Any created Instance
on the client stays there and will not be replicated to others/server.
1 Like
Yes, I just realized that now you said it. How do I create a value in the players character (easiest to access) without using a localscript?
So I can’t use game.player.LocalPlayer.Character
Avzycx
(flawless)
December 29, 2022, 5:47pm
#7
Put it in startercharacterscripts
EgizianoEG
(Egiziano)
December 29, 2022, 5:47pm
#8
Yeah, but you can get a specific player and its character from the server using another approach.
Avzycx
(flawless)
December 29, 2022, 5:48pm
#9
Local player is only accessible in local scripts, the value only exists on the client.
I’ll try, but where to put the serverscript? ServerScriptService?
Avzycx
(flawless)
December 29, 2022, 5:49pm
#11
startercharacterscripts in StarterPlayer
Avzycx
(flawless)
December 29, 2022, 5:49pm
#12
Then try to reference it in your script.
so I could try the following?:
local power = Instance.new("IntValue")
power.Parent = game.StarterPlayer.StarterCharacterScripts
Avzycx
(flawless)
December 29, 2022, 5:55pm
#14
If there are no other issues it should resolve the problem