#I VERY NEED HELP

140 messages · Page 1 of 1 (latest)

signal hollyBOT
#

rankos
Compile Error! Click the errors reaction for more information.
(You may edit your message to recompile.)

ebon sun
#

this hurts to look at

rocky anvil
#

BRUHH

#

My Local Script in TextButtons : `local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()controls:Disable()
local Part49 = workspace.SpawnLocation.P49

script.Parent.MouseButton1Click:Connect(function()
local Money = game.Players.LocalPlayer.leaderstats.Money.Value
if Money >= 5.6 then
character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
else
button.Text = "Pas Assez"
wait(2)
button.Text = "5.6$"
end
end)***My Script in TextButtons:***local TextButton = script.Parent
local ButtonClicked = true

TextButton.MouseButton1Click:Connect(function()
if ButtonClicked then
local Money = game.Players.LocalPlayer.leaderstats.Money
Money.Value = Money.Value - 5.6

    ButtonClicked = false
    wait(1)
    ButtonClicked = true
end

end)`
I don't lose the -$5.6 because I have a customer problem, but I don't know how to use the remoteEvent in this situation I need help it's been 2 days I'm looking for

rocky anvil
ebon sun
#

@rocky anvil script.Parent there would get ServerScriptStorage not the button

rocky anvil
#

no I meant the script in textButtons*

ebon sun
#

still not good to do

untold siloBOT
#

studio** You are now Level 18! **studio

signal hollyBOT
#

rankos
Compile Error! Click the errors reaction for more information.
(You may edit your message to recompile.)

ebon sun
#

you also can't do LocalPlayer in a server script either since it is basically trying to call smth from the client from the server

go to ReplicatedStorage add a new folder called Events and add a new RemoteEvent called "MoneyUpdate"

-- local script
-- do all of your stuff at the top
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate

script.Parent.MouseButton1Click:Connect(function()
    local Money = player.leaderstats.Money
    if Money.Value >= 5.6 then
        --do stuff
        Money.Value -= 5.6;
        MoneyUpdate:FireServer(Money.Value);
    end
end)
-- server script in ServerScriptStorage like it's meant to be
local event = game.ReplicatedStorage.Events.MoneyUpdate;

event.OnServerEvent:Connect(function(player, newmoney) 
    -- do your stuff here
end)
#

@rocky anvil sorry if it's messy of off I wrote it on phone

rocky anvil
#

OHH

ebon sun
#

to do whatever you need to do

#

on the server

#

also gets player

true turtle
#

id reccomend getting and setting the money value on the server

ebon sun
#

yeah

rocky anvil
#

I'm only talking about the first script you sent

true turtle
#

oops

#

youd probably want to replace it with that

ebon sun
#

also move that server script into server script service

#

that's where it's meant to go

rocky anvil
#

I dont understand when you said stuff

rocky anvil
#

@ebon sun

ebon sun
#

server script service

#

eck

#

server script service is literally meant for server scripts

rocky anvil
#

im going to sent you a Picture and tell me if this is good for LocalScript if it's good, i do in Script

ebon sun
#

huh

rocky anvil
#

My local script now :

#

`||local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()controls:Disable()
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate

script.Parent.MouseButton1Click:Connect(function()
local Money = game.Players.LocalPlayer.leaderstats.Money.Value
if Money >= 5.6 then
character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Money.Value -= 5.6;
MoneyUpdate:FireServer(Money.Value)
else
button.Text = "Pas Assez"
wait(2)
button.Text = "5.6$"
end
end)||`

ebon sun
#

what am I looking at

#

oh

#

mobile shit

rocky anvil
#

I did add what you told me?

#

yes or no?

cerulean temple
#

local controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()controls:Disable()

#

hmmmm

#

there should probably be another ) at the end

cerulean temple
#

lol

#

where is the end ) for the require

#
  • wtf is that require
rocky anvil
rocky anvil
cerulean temple
#

require has two parenthesis

#

you have only put one

rocky anvil
#

But it’s work

#

Two parenthesis or not

cerulean temple
#
  • whats the use of the controls in the whole thing anyway
#

I dont see any line using controls

#

oh and btw its not working because thats not how you do its suppose to be uh this:

rocky anvil
cerulean temple
#

wait

cerulean temple
#

lol

proper flint
#

what

cerulean temple
#
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate

script.Parent.MouseButton1Click:Connect(function()
    local Money = player.leaderstats.Money
    if Money.Value >= 5.6 then
        character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
        Money.Value -= 5.6;
        MoneyUpdate:FireServer(Money.Value)
    else
        button.Text = "Pas Assez"
        wait(2)
        button.Text = "5.6$" 
    end
end
rocky anvil
#

i don’t understand you are talking about what

proper flint
#

whats the issue

#

😭

cerulean temple
#

and its dog shit

cerulean temple
proper flint
#

😭

rocky anvil
#

I've been struggling for 2 days with this RemoteEvent thing, I just want that when I press the button, my character's leaderstats loses $5.6 😭

proper flint
#

ok

#

simple

#

make a remote event

#

make a server script and parent it to ServerScriptService

#

make a local script and parent it to StarterPlrScripts

#

in the server script do

cerulean temple
# rocky anvil I've been struggling for 2 days with this RemoteEvent thing, I just want that wh...

try this

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate

script.Parent.MouseButton1Click:Connect(function()
    local Money = player.leaderstats.Money
    if Money.Value >= 5.6 then
        character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
        Money.Value -= 5.6;
        MoneyUpdate:FireServer(Money.Value)
    else
        button.Text = "Pas Assez"
        wait(2)
        button.Text = "5.6$" 
    end
end
#

oh wait he wants the server to do it

#

hmmm

true turtle
#

cupgirl already basically gave everything they need

cerulean temple
#

even chatgpt can do that

proper flint
#

then why this mf still yapppin abt strugglin

cerulean temple
#

CLIENT SCRIPT

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate

script.Parent.MouseButton1Click:Connect(function()
    local Money = player.leaderstats.Money
    if Money.Value >= 5.6 then
        Money.Value -= 5.6
        MoneyUpdate:FireServer(Money.Value)
    else
        button.Text = "Pas Assez"
        task.wait(2)
        button.Text = "5.6$" 
    end
end

SERVER SCRIPT:

local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
MoneyUpdate.OnServerEvent:Connect(function(Player, MoneyValue)
 Player.Character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
 Player.leaderstats.Money.Value = MoneyValue
end)

THIS IS A VERY BAD WAY TO DO IT BTW

#

I just dont give enough shits to make it better

proper flint
#

hold

cerulean temple
#

u havent defined player

proper flint
#

oh right

#

i forgo

cerulean temple
#

.

#

wtf

proper flint
#

trust

#

gng

#

😭

#

idk what im doing either

cerulean temple
#

you realise remote events first parameter is the player on onserverevent..

proper flint
#

ik

#

but i could care less rn

#

🙏

rocky anvil
cerulean temple
# rocky anvil I don't understand anything anymore, I don't know what to put or you sent too ma...

just use the one I send you most recently, create a local script in the button and put this there:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local button = script.Parent
local Part49 = workspace.SpawnLocation.P49
local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate

script.Parent.MouseButton1Click:Connect(function()
    local Money = player.leaderstats.Money
    if Money.Value >= 5.6 then
        Money.Value -= 5.6
        MoneyUpdate:FireServer(Money.Value)
    else
        button.Text = "Pas Assez"
        task.wait(2)
        button.Text = "5.6$" 
    end
end

and then create a normal/server script in serverscriptservice and put this in it:

local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
MoneyUpdate.OnServerEvent:Connect(function(Player, MoneyValue)
 Player.Character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
 Player.leaderstats.Money.Value = MoneyValue
end)
proper flint
#

wait

#

script is under button

cerulean temple
proper flint
#

MF I DIDNT KNOW

cerulean temple
#

ITS OBVIOUS

#

WTF

rocky anvil
proper flint
#

i wasnt reading it

#

i showed him how to use remotes

rocky anvil
#

...

proper flint
#

sob

cerulean temple
#

oh

#

right

#

local MoneyUpdate = game.ReplicatedStorage.Events.MoneyUpdate
MoneyUpdate.OnServerEvent:Connect(function(Player, MoneyValue)
local Character = Player.Character
if not Character then return end
local humanoidRootPart = Character.HumanoidRootPart
Character.Humanoid:MoveTo(humanoidRootPart.Position + Vector3.new(0 ,0, 10))
Player.leaderstats.Money.Value = MoneyValue
end)

rocky anvil
#

Bruh where is my leaderstas

#

wait see

#

i rec

#

wait

#

@cerulean temple @proper flint

#

Im the most unlucky in this world

proper flint
#

your code is just bad

rocky anvil
#

where??

#

my code is good

#

i don't now why i bad

#

i script what i learn only

#

where is bad?

#

I tell you no one can solve this, no one

#

It's an endless loop, every time I try to solve a problem another one appears.